1.Easy
What does WHERE country IN ('NL', 'BE', 'DE') do?
- AKeeps rows whose country is not in the list
- BKeeps rows whose country equals any value in the list
- CKeeps rows whose country value contains all three codes at once
- DSorts rows in the order of the list
2.Easy
How do you sort a result from the highest to the lowest salary?
- AORDER BY salary ASC
- BGROUP BY salary DESC
- CORDER BY salary DESC
- DSORT salary DOWN
3.Easy
GRANT and REVOKE belong to which part of SQL?
- AData Definition Language (DDL)
- BData Manipulation Language (DML)
- CData Control Language (DCL)
- DData Query Language (DQL)
4.Medium
First normal form (1NF) requires that:
- AThere are no foreign keys
- BEach column contains atomic values and there are no repeating groups
- CEvery table has exactly one column
- DEvery non-key column depends on the whole key and on nothing but the key
5.Medium
What does GRANT SELECT ON employees TO alice do?
- AAllows the user alice to read the employees table
- BMakes alice the owner of the database
- CCopies the employees table to alice
- DAllows alice to update and delete rows in the employees table
6.Medium
Which statement removes all rows of a table, keeps its structure and cannot take a WHERE clause?
- ADROP TABLE
- BTRUNCATE TABLE
- CALTER TABLE
- DDELETE FROM with a WHERE clause
7.Hard
Two transactions both read stock = 10, each subtracts 1 and writes the result, giving 9 instead of 8. Which anomaly is this?
- ADirty read
- BLost update
- CPhantom read
- DDeletion anomaly
8.Hard
Which window function assigns 1, 2, 3, ... to rows within each partition without ties?
- ADENSE_RANK()
- BRANK()
- CCOUNT()
- DROW_NUMBER()
Answer key
- 1. B · Keeps rows whose country equals any value in the list
- 2. C · ORDER BY salary DESC
- 3. C · Data Control Language (DCL)
- 4. B · Each column contains atomic values and there are no repeating groups
- 5. A · Allows the user alice to read the employees table
- 6. B · TRUNCATE TABLE
- 7. B · Lost update
- 8. D · ROW_NUMBER()
Full step-by-step solutions: practise this topic on examproblems.com.