0

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 7 0.016 sec

DELIMITER $$

create trigger postponement
 BEFORE insert
 on flight 
for each row BEGIN
IF NEW.Time_of_depart = Flight.Time_of_depart
THEN
SELECT ADDTIME(EW.Time_of_depart, "00:30:00");
END IF;
END $$
DELIMITER ;
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
  • 2
    What you want the trigger to do isn't clear. Sample data and desired results would help. – Gordon Linoff Apr 12 '20 at 20:21
  • i have a flight table with time of departure and date of departure columns for the flights , and i'm trying to delay every new insertion for the the new flights 30 mins only if there's another flight have the same time and date for the departure . Thank you – Enas إيناس Apr 12 '20 at 20:35
  • `IF NEW.Time_of_depart = Flight.Time_of_depart` What do you think, which record from the `Flight` table will be taken for comparison? You must SELECT some definite record from this table using some field from NEW. – Akina Apr 12 '20 at 20:46
  • 1
    It start by the first mention of flight.Time_of_depart You have to select the data prior comparision. The next is when you want to add time to NEW.Time_of_depart it must be SET NEW.Time_of_depart = ADDTIME(NEW.Time_of_depart, "00:30:00"); – nbk Apr 12 '20 at 20:53

0 Answers0