1.Easy
Which keyword sorts the result of a query?
- AORDER BY
- BGROUP BY
- CSORT
- DARRANGE
2.Easy
In a LIKE pattern, what does the % wildcard stand for?
- AAny sequence of zero or more characters
- BExactly one character in that position of the string
- CAny single digit
- DThe end of the string
3.Easy
Statements such as CREATE, ALTER and DROP belong to which part of SQL?
- AData Manipulation Language (DML)
- BData Control Language (DCL)
- CData Definition Language (DDL)
- DTransaction Control Language (TCL)
4.Medium
Second normal form (2NF) removes:
- AForeign keys
- BAll NULL values
- CTransitive dependencies between non-key columns via another non-key column
- DPartial dependencies of non-key columns on part of a composite key
5.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?
- AUse GROUP BY manager_id only
- BCombine the table with itself using UNION ALL and a WHERE filter
- CCreate a second copy of the table on disk
- DJoin the employees table with itself using two aliases
6.Medium
Why does SELECT price * 2 AS double_price FROM t WHERE double_price > 10 fail in most databases?
- AArithmetic is not allowed in the SELECT list
- BWHERE is evaluated before the SELECT list, so the alias does not exist yet
- CWHERE can only compare text columns
- DAliases may not contain an underscore
7.Hard
There is a composite index on (last_name, first_name). Which condition can use it most effectively?
- AWHERE first_name = 'Eva'
- BWHERE last_name = 'Jansen'
- CWHERE first_name LIKE '%a'
- DWHERE UPPER(first_name) = 'EVA'
8.Hard
What is a phantom read?
- AA query that returns no rows
- BA repeated query returns new rows inserted by another committed transaction
- CReading data that was never written
- DReading uncommitted changes
Answer key
- 1. A · ORDER BY
- 2. A · Any sequence of zero or more characters
- 3. C · Data Definition Language (DDL)
- 4. D · Partial dependencies of non-key columns on part of a composite key
- 5. D · Join the employees table with itself using two aliases
- 6. B · WHERE is evaluated before the SELECT list, so the alias does not exist yet
- 7. B · WHERE last_name = 'Jansen'
- 8. B · A repeated query returns new rows inserted by another committed transaction
Full step-by-step solutions: practise this topic on examproblems.com.