1.Easy
Which SQL keyword removes duplicate rows from a result?
- ASINGLE
- BDISTINCT
- CDIFFERENT
- DUNIQUE
2.Easy
In a LIKE pattern, what does the _ (underscore) wildcard stand for?
- AA space character
- BAny letter but no digits
- CZero or more characters
- DExactly one character
3.Easy
In a LIKE pattern, what does the % wildcard stand for?
- AExactly one character in that position of the string
- BThe end of the string
- CAny single digit
- DAny sequence of zero or more characters
4.Medium
When is WHERE EXISTS (subquery) true for a row?
- AWhen the subquery returns a number greater than zero
- BWhen the subquery returns exactly one row
- CWhen the subquery returns no NULL values
- DWhen the subquery returns at least one row
5.Medium
A view in SQL is:
- AA screen in the database client for browsing tables
- BA copy of a table on disk
- CA stored query that behaves like a virtual table
- DAn index type
6.Medium
Table a has 3 rows and table b has 4 rows. How many rows does SELECT * FROM a CROSS JOIN b return?
- A3
- B7
- C4
- D12
7.Hard
What is a phantom read?
- AReading uncommitted changes
- BA repeated query returns new rows inserted by another committed transaction
- CReading data that was never written
- DA query that returns no rows
8.Hard
The query FROM customers c LEFT JOIN orders o ON o.customer_id = c.id WHERE o.status = 'paid' unexpectedly drops customers with no orders. Why?
- AThe join should use USING instead of ON
- BThe WHERE condition on o rejects the NULL-filled rows, turning it into an inner join
- CLEFT JOIN never keeps unmatched rows
- Dstatus is a reserved word
Answer key
- 1. B · DISTINCT
- 2. D · Exactly one character
- 3. D · Any sequence of zero or more characters
- 4. D · When the subquery returns at least one row
- 5. C · A stored query that behaves like a virtual table
- 6. D · 12
- 7. B · A repeated query returns new rows inserted by another committed transaction
- 8. B · The WHERE condition on o rejects the NULL-filled rows, turning it into an inner join
Full step-by-step solutions: practise this topic on examproblems.com.