The CREATE TRIGGER statement is used to create the trigger. THE _________ clause specifies the table name on which the trigger is to be attached. The ___________ pecifies that this is an AFTER INSERT trigger.
Show Hint
- In SQL, ON is used to specify the table for the trigger.
- FOR INSERT is used to specify that the trigger activates after an INSERT operation.
Step 1: Understanding CREATE TRIGGER Syntax
The syntax of the CREATE TRIGGER statement in SQL is:
\[
\texttt{CREATE TRIGGER trigger\_name}
\]
\[
\texttt{ON table\_name}
\]
\[
\texttt{FOR INSERT}
\]
\[
\texttt{AS}
\]
\[
\texttt{-- trigger body}
\]
- The ON clause specifies the table on which the trigger is applied.
- The FOR INSERT clause specifies the event that triggers the action.
Step 2: Evaluating the Options
- (A) Incorrect: The order is wrong. The correct SQL syntax uses `ON` first.
- (B) Correct: `ON` specifies the table, and `FOR INSERT` specifies the event.
- (C) Incorrect: `FOR` does not specify the table; `ON` is required instead.
- (D) Incorrect: `FOR, FOR INSERT` is not a valid SQL syntax.