sqlite trigger 1

SQLite's trigger (Trigger) can be specified to be triggered when DELETE, INSERT or UPDATE occurs in a specific database table, or triggered when the columns of one or more specified tables are updated.

SQLite only supports FOR EACH ROW trigger (Trigger), no FOR EACH STATEMENT trigger (Trigger).

I have a mytest.db, start sqlite3 and load it; look at the data in the following two tables;

Then create a trigger, when a record is inserted in the tz_1 table, a record is also inserted in the tz_2 table;

 

        As shown in the figure above, the trigger is created and the effect is achieved; I don’t know the sql in the trigger yet, how to get the field value of the tz_1 record just inserted when inserting into the tz_2 table, and continue when I have time;

 

Guess you like

Origin blog.csdn.net/bcbobo21cn/article/details/131887719