The following restrictions apply: Triggers may be created on views, as well as ordinary tables, by specifying INSTEAD OF in the CREATE TRIGGER statement.
If one or more ON INSERT, ON DELETE or ON UPDATE triggers are defined on a view, then it is not an error to execute an INSERT, DELETE or UPDATE statement on the view, respectively.
The CREATE TRIGGER statement is used to add triggers to the database schema.
Triggers are database operations that are automatically performed when a specified database event occurs.
Because of the behaviors described above, programmers are encouraged to prefer AFTER triggers over BEFORE triggers.
A special SQL function RAISE() may be used within a trigger-program, with the following syntax raise-function: When one of RAISE(ROLLBACK,...), RAISE(ABORT,...) or RAISE(FAIL,...) is called during trigger-program execution, the specified ON CONFLICT processing is performed the current query terminates.
At this time SQLite supports only FOR EACH ROW triggers, not FOR EACH STATEMENT triggers.
Triggers are automatically dropped when the table that they are associated with (the table-name table) is dropped.
However if the trigger actions reference other tables, the trigger is not dropped or modified if those other tables are dropped or modified.
Hence explicitly specifying FOR EACH ROW is optional.
FOR EACH ROW implies that the SQL statements specified in the trigger may be executed (depending on the WHEN clause) for each database row being inserted, updated or deleted by the statement causing the trigger to fire.