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
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
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
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.
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
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
Explanation: INSTEAD OF triggers cause their source DML operation to skip and they just execute the code provided inside them.
6. AFTER trigger in SQL Server can be applied to _________________
a) Table
b) Views
c) Table and Views
d) Function
View Answer
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
Explanation: In SQL Server we can create triggers on DML statements (like INSERT, UPDATE, and DELETE) and stored procedures that perform DML-like operations.
8. Triggers created with FOR or AFTER keywords is _____________
a) AFTER
b) INSTEAD OF
c) CLR
d) All of the mentioned
View Answer
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
Explanation: Valid trigger actions are INSERT, UPDATE and DELETE, or a combination of several, separated by commas.
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
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.
- Apply for Programming Internship
- Check SQL Server Books
- Practice Programming MCQs
- Check Information Technology Books