Sample Exam Questions
※This sample exam is different from those that appear in the actual OSS-DB Exam.
2024/05/01
In a database, you can set triggers to execute simultaneously with table updates, allowing other columns or tables to be updated at the same time. In PostgreSQL, triggers are defined by defining a function of type TRIGGER with CREATE FUNCTION and associating it with a table using CREATE TRIGGER.
There are several types of triggers, but the main categories are BEFORE triggers, which execute before table data is updated, and AFTER triggers, which execute after the update. In addition, there are statement-level triggers, which execute only once for each SQL statement execution, and row-level triggers, which execute individually for each row that is updated. Combined with BEFORE/AFTER, there are four types of triggers (there is also a type called an INSTEAD OF trigger).
When an UPDATE statement is issued to a table, the statement-level BEFORE trigger is executed first, followed by the row-level BEFORE trigger for each row to be updated. Once the BEFORE triggers have finished executing, the main body of the UPDATE statement is executed and the table is updated. Afterwards, in reverse order of BEFORE, the row-level AFTER trigger is executed for each row that was updated, followed by the statement-level AFTER trigger.
Therefore, the correct answer is B.
© EDUCO All Rights Reserved.