What is the difference between constraints and triggers?
S.no | Constraints | Triggers |
---|---|---|
1. | This is defined by the relationship between data elements. | These are the actions that are executed when a specific reaction occurs. |
2. | It is used for a column. | It is used for a table. |
3. | These are useful for database consistency. | These are used for logging and auditing. |
4. | It precedes triggers when getting fired. | First constraints get fired. Only then do triggers get fired. |
BY Best Interview Question ON 27 Jun 2020