Loading

Quipoin Menu

Learn • Practice • Grow

sql / Triggers
mcq
Direction: Choose the correct option

Q1.

What is a trigger in SQL?
A. Index
B. View
C. Automatically executes on table events
D. Manual procedure
Direction: Choose the correct option

Q2.

CREATE TRIGGER validate_age BEFORE INSERT ON students FOR EACH ROW BEGIN IF NEW.age < 18 THEN SIGNAL SQLSTATE '45000'; END IF; END;
When does this trigger fire?
A. Before each row insertion
B. On delete
C. After each insertion
D. On update
Direction: Choose the correct option

Q3.

CREATE TRIGGER after_emp_insert AFTER INSERT ON employees FOR EACH ROW INSERT INTO audit VALUES (NEW.id, 'INSERT', NOW());
What does this trigger do?
A. Prevents inserts
B. Logs new employee insertions
C. Updates employees
D. Deletes records
Direction: Choose the correct option

Q4.

CREATE TRIGGER update_timestamp BEFORE UPDATE ON employees FOR EACH ROW SET NEW.last_modified = NOW();
What is NEW referring to?
A. New values being updated
B. Old values
C. Database name
D. Table name
Direction: Choose the correct option

Q5.

How do you remove a trigger?
A. REMOVE TRIGGER
B. ALTER TRIGGER
C. DELETE TRIGGER
D. DROP TRIGGER