1.Easy
Which constraint makes sure a column can never be left empty (NULL)?
- ADEFAULT
- BCHECK NULL
- CUNIQUE
- DNOT NULL
2.Easy
Which SQL keyword removes duplicate rows from a result?
- AUNIQUE
- BDIFFERENT
- CDISTINCT
- DSINGLE
3.Easy
In a LIKE pattern, what does the _ (underscore) wildcard stand for?
- AAny letter but no digits
- BZero or more characters
- CExactly one character
- DA space character
4.Medium
What does EXCEPT (called MINUS in Oracle) return?
- ARows of the second query that do not appear in the first one
- BRows that appear in both queries
- CAll rows from both queries without duplicates
- DRows of the first query that do not appear in the second
5.Medium
A foreign key is declared with ON DELETE CASCADE. What happens when a parent row is deleted?
- AThe foreign key in the child rows is set to NULL automatically
- BThe delete is always rejected
- CThe parent row is copied to an archive table
- DThe child rows that reference it are deleted automatically
6.Medium
An employees table has a column manager_id that refers to another employee. How do you list each employee next to their manager's name?
- ACombine the table with itself using UNION ALL and a WHERE filter
- BUse GROUP BY manager_id only
- CCreate a second copy of the table on disk
- DJoin the employees table with itself using two aliases
7.Hard
Two doctors on call each check that the other is still on call, then both sign off at the same time. Which anomaly can snapshot isolation still allow here?
- ADirty write
- BWrite skew
- CNon-repeatable read within one transaction
- DDirty read
8.Hard
Which window function assigns 1, 2, 3, ... to rows within each partition without ties?
- ACOUNT()
- BRANK()
- CROW_NUMBER()
- DDENSE_RANK()
Answer key
- 1. D · NOT NULL
- 2. C · DISTINCT
- 3. C · Exactly one character
- 4. D · Rows of the first query that do not appear in the second
- 5. D · The child rows that reference it are deleted automatically
- 6. D · Join the employees table with itself using two aliases
- 7. B · Write skew
- 8. C · ROW_NUMBER()
Full step-by-step solutions: practise this topic on examproblems.com.