Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql trigger after update

CREATE TRIGGER after_sales_update
AFTER UPDATE
ON sales FOR EACH ROW
BEGIN
    IF OLD.quantity <> new.quantity THEN
        INSERT INTO SalesChanges(salesId,beforeQuantity, afterQuantity)
        VALUES(old.id, old.quantity, new.quantity);
    END IF;
END$$
Comment

PREVIOUS NEXT
Code Example
Sql :: insert random numbers in columns postgress 
Sql :: ALL_TAB_PARTITIONS 
Sql :: sqlite create index 
Sql :: mysql bigint max value 
Sql :: access the postgres psql 
Sql :: update select 
Sql :: how to count null values in mysql 
Sql :: mysql change data type of column 
Sql :: plsql code for deleting a row from nested table in oracle 
Sql :: add postgresql to path 
Sql :: row number mysql 
Sql :: sql insert query 
Sql :: postgresql substring last 
Sql :: remove transient options sql wordpress 
Sql :: postgres date difference seconds 
Sql :: alter table 
Sql :: mysqldump: couldn 
Sql :: how to delete git repo locally 
Sql :: oracle grant select on schema 
Sql :: select all field names for a table mysql 
Sql :: mysql convert column to uppercase 
Sql :: where date major today mysql 
Sql :: oracle sessions_per_user 
Sql :: mysql docker 
Sql :: oracle undotbs usage 
Sql :: postgresql list users 
Sql :: oracle add auto_increment column to existing table 
Sql :: mysql start command 
Sql :: copy data from one table column to another table column in sql 
Sql :: input in mysql 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =