SQLite Drop Trigger

In this article we will show how to drop a trigger in SQLite database using the DROP TRIGGER statement.
There are two ways to drop a trigger from the SQLite database.

The first way is when you want to delete a specified trigger, use the DROP TRIGGER statement, followed by the name of the trigger. The second way is when you drop a table that has one or more triggers associated with it.

The syntax for deleting a trigger from the SQLite database is as follows:

Syntax

DROP TRIGGER [IF EXISTS] [schema_name].trigger_name;

Example

The following example shows the creation of a trigger in the SQLite database, to then remove the trigger.

CREATE TRIGGER IF NOT EXISTS customers_log_ins
BEFORE INSERT ON customers
FOR EACH ROW
BEGIN
INSERT INTO customers_log(id,name,city,has_orders,log_date,log_message) 
VALUES (NEW.id,NEW.name,NEW.city,NEW.has_orders,DATETIME(),'insert');
END;

To remove the customers_log_ins trigger, execute the following statement:

DROP TRIGGER IF EXISTS customers_log_ins;