[go: up one dir, main page]

Menu

[d66369]: / doc / sql / trigger.sql  Maximize  Restore  History

Download this file

11 lines (7 with data), 319 Bytes

1
2
3
4
5
6
7
8
CREATE TABLE item_ids (id INTEGER PRIMARY KEY AUTOINCREMENT, dumb INTEGER DEFAULT 0)
CREATE TRIGGER after_insert_on_items AFTER INSERT ON items FOR EACH ROW
BEGIN
INSERT INTO item_ids (dumb) VALUES (0);
UPDATE items SET id = last_insert_rowid() WHERE id=NEW.id;
END
INSERT INTO items (title) VALUES ('test')