About Triggers
-
This is my first time of creating a trigger..I tried to create trigger using mysql to count how many "2007" data are in the table when inserting new record but it not working properly it wont display how 2007 data are in my table....... 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
-
This is my first time of creating a trigger..I tried to create trigger using mysql to count how many "2007" data are in the table when inserting new record but it not working properly it wont display how 2007 data are in my table....... 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
dili1234 wrote:
how many "2007" data are in the table when inserting new record
dili1234 wrote:
CREATE TRIGGER No_of_Publisher_year Before Insert
The
before
keyword may be why you are not seeing the results you expect.“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
-
dili1234 wrote:
how many "2007" data are in the table when inserting new record
dili1234 wrote:
CREATE TRIGGER No_of_Publisher_year Before Insert
The
before
keyword may be why you are not seeing the results you expect.“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens