CREATE TRIGGER mytrigger AFTER INSERT ON table_a
BEGIN
INSERT INTO table_b VALUES(NULL,new.primary_id)
END;
Easy, non? Now you have to import the trigger into the sqlite database. Assuming you have already got a database called mydb.db, use this command:
sqlite3 mydb.db < trigger.txt
Now, when you enter a row into table a, a row should automagically be appended to table b.
Keine Kommentare:
Kommentar veröffentlichen