How To Use Triggers to Track Changes in MySQL

on Code Spatter from 35 weeks ago

OLD and NEW are used on UPDATE triggers. OLD.col_names will access the data that is in the row of the database before the UPDATE query runs and NEW.col_names will access the data that the row will be updated to.

IF OLD.first_name != NEW.first_name

That checks if the UPDATE query is changing the information for first_name.

Greg Allard
Greg Allard
Name
Greg Allard
Web
codespatter.com
About Me
Web Developer