1.Easy
A foreign key is:
- AA column that refers to the primary key of another table
- BA key that is always encrypted
- CA column whose values must be unique across all rows of the table
- DA key used by foreign users
2.Easy
How do you sort a result from the highest to the lowest salary?
- AORDER BY salary DESC
- BORDER BY salary ASC
- CSORT salary DOWN
- DGROUP BY salary DESC
3.Easy
A customer can place many orders, but each order belongs to exactly one customer. What type of relationship is this?
- AMany-to-many
- BZero-to-zero
- COne-to-many
- DOne-to-one
4.Medium
A table has rows where col is NULL. Which rows does WHERE col = NULL return?
- AAll rows of the table
- BNo rows, because the comparison is unknown
- CAn error in every database
- DOnly the rows where col is NULL, as with IS NULL
5.Medium
Table a has 3 rows and table b has 4 rows. How many rows does SELECT * FROM a CROSS JOIN b return?
- A4
- B7
- C3
- D12
6.Medium
What does INTERSECT return when used between two SELECT queries?
- ARows in the first result but not the second
- BThe Cartesian product of the results
- CRows that appear in both results
- DAll rows from both results
7.Hard
What is a phantom read?
- AReading data that was never written
- BA query that returns no rows
- CReading uncommitted changes
- DA repeated query returns new rows inserted by another committed transaction
8.Hard
R(A, B, C, D) has the functional dependencies A → B and C → D. What is the candidate key?
- A{C}
- B{B, D}
- C{A}
- D{A, C}
Answer key
- 1. A · A column that refers to the primary key of another table
- 2. A · ORDER BY salary DESC
- 3. C · One-to-many
- 4. B · No rows, because the comparison is unknown
- 5. D · 12
- 6. C · Rows that appear in both results
- 7. D · A repeated query returns new rows inserted by another committed transaction
- 8. D · {A, C}
Full step-by-step solutions: practise this topic on examproblems.com.