 <p>When posting questions in future, it really helps to include the error message. Here it is.</p> <blockquote> <p>ERROR 1064 (42000): 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 'from attraction join ticketBooking using(attractionID)</p> </blockquote> <p>Your basic syntax error here is immediately before 'from attraction', we find</p> <pre><code> set @package1=(select(sum(ticketprice*numTickets) </code></pre> <p>The problem here is that SELECT() is not valid syntax. Correct syntax is SELECT followed by a space. This appears to be an extra unmatched bracket, so you can simply remove it like so:</p> <pre><code>delimiter // create trigger estimatedCost_bi after insert on ticketBooking for each row begin set @package1=(select sum(ticketprice*numTickets) from attraction join ticketBooking using(attractionID) join package using(packageNo) where package.packageNo=new.packageNo); </code></pre> <p>update package join ticketBooking using(packageNo)</p> <p>set estimatedCost = @package1</p> <p>where ticketBooking.packageNo=new.packageNo; end// delimiter ;</p>