Through Schema API (file mymodule.install in Folder sites\all\modules\mymodule). trigger in mysql:
delimiter |
CREATE TRIGGER testref AFTER INSERT ON users
FOR EACH ROW BEGIN
INSERT INTO beep SET uid = NEW.uid;
END;
|
delimiter ;