Home > database >  Mysql error query builder does not support this syntax near "trigger"
Mysql error query builder does not support this syntax near "trigger"

Time:09-24

Create the TRIGGER db_trigger1 on db_dwy. Orderitem for update
As
The BEGIN
If the EXISTS (select * from db_dwy. Orderitem where order_id=9 '5 dc927e2 - c4f - 4817 - bca6 - a11d796db8c7')
DROP table orderitem
The else
The begin
The CREATE TABLE orderitem (
User_id int IDENTIFIED (1, 1) PRIMARY KEY,
User_name varchar (50),
User_pwd VARCHAR (50)

)
INSERT INTO orderitem (user_name user_pwd) VALUES (' hy1 ', '111')
INSERT INTO orderitem (user_name user_pwd) VALUES (' hy2 ', '222')
INSERT INTO orderitem (user_name user_pwd) VALUES (' hy3 ', '333')
END
END















CodePudding user response:

Not create syntax

CREATE the TRIGGER trigger_name trigger_time trigger_event
ON tbl_name FOR EACH ROW trigger_stmt

Trigger_time is the triggering time of the trigger, can be BEFORE or AFTER, BEFORE the meaning of refers to trigger BEFORE the check constraint, and AFTER is triggered AFTER the check constraint,
And trigger_event is the trigger to trigger events, can be INSERT, UPDATE, or DELETE,
On the same table same triggering time of the trigger event, only to define a trigger,
  • Related