this is my first time of creating trigger..I tried to create trigger using mysql to count how many 2007 data in the table when inserting new record but it not working.......
My table have more than 50 data...
CREATE TRIGGER No_of_Publisher_year Before Insert ON Book FOR EACH ROW SET @Count_No=New.Copyright;
SET @Count_NO=0;
INSERT INTO Book VALUES(14,'Programming Perl','978-0-201-70073-2','WI','2007-12-11',25.23,2,2007);
SELECT Count(@Count_NO) AS 'No_of_publisher_in_year_2007' FROM Book WHERE Copyright=2007;