MySQL Triggers




In this tutorial, I will teach you MySQL Triggers Website: http://codingpassiveincome.com It is MySQL Tutorial For Beginners. A SQL trigger is a set of SQL …

Original source


40 responses to “MySQL Triggers”

  1. Is it possible to use triggers in same table after update …

    ex : there are 3 fields [required,paid,status]
    in users table
    I nees to compare paid field with required field after update in line 11 and 12 and if both are equals then update status field … How to do it ?

  2. Can anyone please tell me what is the error of below given code?

    DELIMITER $$
    create trigger after_videor_update
    after INSERT on video_ratings
    for each row
    begin
    declare updatecount integer(10);
    updatecount = select count(RATINGS) AS BAD_TOTAL from video_ratings where RATINGS='0');
    update video_upload
    SET RATE_BAD = updatecount
    where USER_ID = NEW.STU_ID AND ID = NEW.VID_ID
    END$$
    DELIMITER ;

  3. Good tutorial, but please drop the music next time. The recording of your voice is already resounding in your room and the music gives me a hard time understanding what you are saying (plus the same loop over and over again starts to be annoying after a few times). No hard feelings though.

Leave a Reply