SQL Server Questions and Answers – DML Triggers

This set of SQL Server Multiple Choice Questions & Answers (MCQs) focuses on “DML Triggers”.

1. Trigger is special type of __________ procedure.
a) Stored
b) Function
c) View
d) Table
View Answer

Answer: a
Explanation: Triggers are used to assess/evaluate data before or after data modification using DDL and DML statements.

2. Point out the correct statement.
a) Triggers are database object
b) Three types of triggers are present in SQL Server
c) A DDL trigger is an action programmed to execute when a data manipulation language (DML) event occurs in the database server
d) None of the mentioned
View Answer

Answer: a
Explanation: Triggers are special type of stored procedure that automatically executes when a DDL or DML statement associated with the trigger is executed.

3. How many types of triggers are present in SQL Server?
a) 4
b) 5
c) 8
d) 9
View Answer

Answer: a
Explanation: In Sql Server we can create four types of triggers Data Definition Language (DDL) triggers, Data Manipulation Language (DML) triggers, CLR triggers and Logon triggers.
advertisement
advertisement

4. How many types of DML triggers are present in SQL Server?
a) 1
b) 3
c) 5
d) None of the mentioned
View Answer

Answer: d
Explanation: We have two types of DML triggers-AFTER and INSTEAD OF.

5. Point out the wrong statement.
a) We can have an INSTEAD OF insert/update/delete trigger on a table that successfully executed
b) DML Triggers are used to evaluate data after data manipulation using DML statements
c) INSTEAD OF triggers cause their source DML operation to skip
d) AFTER triggers cause their source DML operation to skip
View Answer

Answer:d
Explanation: INSTEAD OF triggers cause their source DML operation to skip and they just execute the code provided inside them.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. AFTER trigger in SQL Server can be applied to _________________
a) Table
b) Views
c) Table and Views
d) Function
View Answer

Answer: c
Explanation: AFTER trigger fires after SQL Server completes the execution of the action successfully that fired it.

7. DML triggers in SQL Server is applicable to _____________
a) Insert
b) Update
c) Delete
d) All of the mentioned
View Answer

Answer: d
Explanation: In SQL Server we can create triggers on DML statements (like INSERT, UPDATE, and DELETE) and stored procedures that perform DML-like operations.
advertisement

8. Triggers created with FOR or AFTER keywords is _____________
a) AFTER
b) INSTEAD OF
c) CLR
d) All of the mentioned
View Answer

Answer: a
Explanation: AFTER triggers do not work for views.

9. Which of the following is not a typical trigger action?
a) Insert
b) Select
c) Delete
d) All of the mentioned
View Answer

Answer: b
Explanation: Valid trigger actions are INSERT, UPDATE and DELETE, or a combination of several, separated by commas.
advertisement

10. Triggers can be enabled or disabled with the ________ statement.
a) ALTER TABLE statement
b) DROP TABLE statement
c) DELETE TABLE statement
d) None of the mentioned
View Answer

Answer: a
Explanation: You can also use the ALL keyword instead of a trigger name to enable/disable all of the triggers on a table in question.

Sanfoundry Global Education & Learning Series – SQL Server.

To practice all areas of SQL Server, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.