Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含登录表和注册表的数据库。我在注册表中有用户名和密码列。当这些列被填满时,我希望它们也自动出现在登录表上。谁能建议我如何获得这种效果
使用插入触发器将数据添加到另一个表
delimiter | CREATE TRIGGER reg_trigger AFTER INSERT ON registration FOR EACH ROW BEGIN insert into login (username, password) VALUES (NEW.username, NEW.password); END | delimiter ;
简单的一种是在注册表上插入后使用触发器,内部触发器写入登录表。