DML Statements & Locking MCQs

13 MCQs  — Oracle: Modifying Data & Multiple Databases MCQs  (Page 1 of 2)

Practice DML Statements & Locking MCQs with correct answers and explanations. These questions are from the Oracle: Modifying Data & Multiple Databases MCQs section.

Which statement correctly deletes the employee with ID 5?
DELETE emp WHERE id = 5 ROWS;
DELETE FROM emp WHERE id = 5;
REMOVE FROM emp WHERE id = 5;
DROP ROW FROM emp WHERE id = 5;
Which statement correctly updates a salary?
UPDATE emp SET salary = 5000 WHERE id = 5;
UPDATE emp VALUES salary = 5000 WHERE id = 5;
MODIFY emp SET salary = 5000 WHERE id = 5;
UPDATE emp TO salary = 5000 WHERE id = 5;
Which UPDATE correctly sets a value from a subquery?
UPDATE emp SET salary = SELECT MAX(salary) FROM emp WHERE id = 5;
UPDATE emp WITH (SELECT MAX(salary)) WHERE id = 5;
UPDATE emp SET salary = FROM (SELECT MAX(salary)) WHERE id = 5;
UPDATE emp SET salary = (SELECT MAX(salary) FROM emp) WHERE id = 5;
In a conditional multitable insert, what does INSERT FIRST do?
Inserts the first row only
Inserts into all tables whose condition is true
Inserts each row only into the first table whose condition is true
Inserts rows in sorted order
What does PRAGMA AUTONOMOUS_TRANSACTION do in PL/SQL?
Disables all locks
Lets a block run its own independent transaction that commits separately
Turns off logging
Rolls back the main transaction
Which statement about Oracle's locking is correct?
Readers block all writers
Writers always block readers
Readers do not block writers, and writers do not block readers
Oracle locks the whole table for each update
Which statement manually locks a table in exclusive mode?
LOCK emp EXCLUSIVE;
SET LOCK emp EXCLUSIVE;
LOCK TABLE emp IN EXCLUSIVE MODE;
ALTER TABLE emp LOCK;
What does SELECT ... FOR UPDATE NOWAIT do when the rows are already locked?
Waits forever
Skips the locked rows silently
Returns an error immediately instead of waiting
Deletes the locks
Which is Oracle's default transaction isolation level?
READ COMMITTED
SERIALIZABLE
READ UNCOMMITTED
REPEATABLE READ
Which statement makes a transaction see a consistent snapshot and permits no DML?
SET TRANSACTION READ ONLY;
SET TRANSACTION SNAPSHOT;
ALTER SESSION FREEZE;
SET LOCK READ;