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.
我有以下情况:
我必须将 CSV 文件导入到表中。为此,我使用 LOAD DATA LOCAL INFILE。
有没有办法检索所有插入行的id(列'id'),因为我在下一步需要它们。
创建一个 BEFORE INSERT 或 AFTER INSERT 触发器并将插入的 ID 值存储到另一个表中 -
CREATE TRIGGER trigger1 AFTER INSERT ON table1 FOR EACH ROW BEGIN INSERT INTO table2(id) VALUES (NEW.id); END