what is the difference between trigger and constraint?

Answer Posted / milind chopde

1) Constraints can be used for validation but trigger can be used for complex validation and auditing purpose.
2) Trigger is database object but constraint not.
3) Trigger can be fired on DDL commands but constraints are created or altered using DDL commands.
4) Trigger can be fired on particular event like before/after DML but constraint always check before any data insert or update to table.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why plvtab is considered as the easiest way to access the pl/sql table?

835


How to change a value of the field ‘salary’ as 7500 for an employee_name ‘john’ in a table employee_details?

1160


Can primary key be changed?

666


How to get each name only once from an employee table?

807


What is identity column in sql server?

718






What is a ddl command?

722


What does truncate mean in sql?

722


What is partition by in sql?

784


If i can use sys.check_constraints to display my constraints from my database using sql server 2005, how can i display then if i am using sql server 2000????

3699


What are different types of queries in sql?

735


Does truncate need commit?

699


Why sql query is slow?

731


What is clustered index in sql?

785


What is the syntax and use of the coalesce function?

812


Is big data nosql?

692