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;

It not possible to do any operation on same table whose trigger you are writing.

I am writing trigger to my own table...
Which I can Access

Member Avatar for diafol

A urtrivedi says. You are triggering an operation on BOOKS before an operation on BOOKS.

simply put: your trigger performs an operation on your table which triggers your trigger which performs an operation on your table which...
And in the end your database engine crashes with a stack overflow error.

commented: Succinctly put +15

haha

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.