A database trigger is a procedural code that automatically changes information in one or more databases in response to a change on another database or table. For example, when an employer creates a slot in a list of employees for a new employee, the database trigger in that list should automatically add the new employee to lists for vacations, sick days, salaries, and/or other information. Database triggers prevent computer administrators from having to manually add new information to multiple tables, charts, or databases.

 

How Database Triggers Work

A database trigger can be any type of code that is embedded in a table, chart, database, or other work area and serves to automatically make changes to another work area in response to changes. Database triggers are generally written in the Database Manipulation Language, or DML, and can be implemented on a wide variety of platforms, including Oracle, Microsoft SQL Server, PostgreSQL, Firebird, MySQL, IBM DB2 LUW, SQLite, and XML databases.

 

Applications

Database triggers can be used to modify data in one database in response to changes in another database. In addition to copying information from one work area to another, a database trigger may also be used to log information whenever a change is made, such as the name of the person who changed it and the time the information was altered.

 

Advantages

Database triggers are advantageous because they can be implemented in a document without being seen by the user and prevent the user from having to enter the same information more than once. Database triggers are also helpful for recording information about a system or the users who access it and can aid in preventing unauthorized users from altering information.