MySQL创建触发器时报错Error Code: 1064

问题描述:
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 9

代码如下:

图片说明

已解决
需要加delimiter

delimiter //
DROP TRIGGER IF EXISTS add_ticket;
CREATE TRIGGER add_ticket
before INSERT ON ticket
FOR EACH ROW
begin
if new.ccol not in(select distinct ccol from Seat
where Cin_id=new.Cin_id and Hall_id =new.Hall_id and rrow=new.rrow )
then
insert into seat(Cin_id,Hall_id,rrow,ccol) values(new.Cin_id,new.Hall_id,new.rrow,new.ccol);
end if;
if new.price>100
then
SIGNAL SQLSTATE 'HY000' SET MESSAGE_TEXT = '价格过高' ;
end if;
end//

没写完整,下面加上一个 END IF