1.Easy
What is a composite key?
- AA key that is generated by the database
- BA key made up of two or more columns
- CA key stored in a separate table
- DA key that allows duplicate values
2.Easy
Which SQL keyword removes duplicate rows from a result?
- AUNIQUE
- BDISTINCT
- CSINGLE
- DDIFFERENT
3.Easy
Which SQL statement changes values in rows that already exist?
- AINSERT
- BUPDATE
- CMODIFY
- DREPLACE COLUMN
4.Medium
Third normal form (3NF) removes:
- ARedundant indexes on columns that are not part of a key
- BTransitive dependencies between non-key attributes
- CComposite keys
- DAtomic values
5.Medium
What is a dirty read?
- AReading data written by another transaction that has not yet committed
- BReading the same row twice and getting the same value
- CReading data from a corrupted disk
- DReading data without a WHERE clause
6.Medium
Second normal form (2NF) removes:
- AForeign keys
- BTransitive dependencies between non-key columns via another non-key column
- CAll NULL values
- DPartial dependencies of non-key columns on part of a composite key
7.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?
- ATRUE is treated as NULL by the index
- BMost rows match, so a full table scan is cheaper than many index lookups
- CIndexes cannot be created on Boolean columns
- DThe optimiser never uses indexes in WHERE clauses
8.Hard
Two transactions both read stock = 10, each subtracts 1 and writes the result, giving 9 instead of 8. Which anomaly is this?
- APhantom read
- BDirty read
- CLost update
- DDeletion anomaly
Answer key
- 1. B · A key made up of two or more columns
- 2. B · DISTINCT
- 3. B · UPDATE
- 4. B · Transitive dependencies between non-key attributes
- 5. A · Reading data written by another transaction that has not yet committed
- 6. D · Partial dependencies of non-key columns on part of a composite key
- 7. B · Most rows match, so a full table scan is cheaper than many index lookups
- 8. C · Lost update
Full step-by-step solutions: practise this topic on examproblems.com.