1.Easy
What does COMMIT do in a transaction?
- AStarts a new table
- BMakes all changes of the transaction permanent
- CUndoes all changes made since the transaction began
- DLocks the whole database
2.Easy
A foreign key is:
- AA key used by foreign users
- BA column whose values must be unique across all rows of the table
- CA column that refers to the primary key of another table
- DA key that is always encrypted
3.Easy
Which statement deletes a whole table, including its structure?
- ATRUNCATE ROWS
- BDROP TABLE
- CREMOVE TABLE
- DDELETE FROM
4.Medium
A LEFT JOIN returns:
- ARows that match in neither table
- BOnly matching rows from both tables
- CAll rows from the left table and matching rows from the right, with NULLs where there is no match
- DAll rows from the right table only
5.Medium
What does EXCEPT (called MINUS in Oracle) return?
- ARows of the first query that do not appear in the second
- BRows of the second query that do not appear in the first one
- CRows that appear in both queries
- DAll rows from both queries without duplicates
6.Medium
What does INTERSECT return when used between two SELECT queries?
- AThe Cartesian product of the results
- BRows in the first result but not the second
- CRows that appear in both results
- DAll rows from both results
7.Hard
Two-phase locking (2PL) ensures:
- AConflict-serializable schedules
- BThat transactions never wait
- CThat no locks are needed
- DThat deadlocks can never happen
8.Hard
A table has a million rows and a Boolean column is_active that is TRUE for 95% of them. Why might the optimiser ignore an index on is_active for WHERE is_active = TRUE?
- AThe optimiser never uses indexes in WHERE clauses
- BMost rows match, so a full table scan is cheaper than many index lookups
- CIndexes cannot be created on Boolean columns
- DTRUE is treated as NULL by the index
Answer key
- 1. B · Makes all changes of the transaction permanent
- 2. C · A column that refers to the primary key of another table
- 3. B · DROP TABLE
- 4. C · All rows from the left table and matching rows from the right, with NULLs where there is no match
- 5. A · Rows of the first query that do not appear in the second
- 6. C · Rows that appear in both results
- 7. A · Conflict-serializable schedules
- 8. B · Most rows match, so a full table scan is cheaper than many index lookups
Full step-by-step solutions: practise this topic on examproblems.com.