1.Easy
GRANT and REVOKE belong to which part of SQL?
- AData Definition Language (DDL)
- BData Control Language (DCL)
- CData Manipulation Language (DML)
- DData Query Language (DQL)
2.Easy
A customer can place many orders, but each order belongs to exactly one customer. What type of relationship is this?
- AOne-to-one
- BZero-to-zero
- CMany-to-many
- DOne-to-many
3.Easy
Which SQL statement changes values in rows that already exist?
- AINSERT
- BUPDATE
- CREPLACE COLUMN
- DMODIFY
4.Medium
What is a dirty read?
- AReading data from a corrupted disk
- BReading data without a WHERE clause
- CReading data written by another transaction that has not yet committed
- DReading the same row twice and getting the same value
5.Medium
What does SELECT COALESCE(phone, 'unknown') FROM customers return for a customer whose phone is NULL?
- AAn empty string
- B'unknown'
- CNULL
- DAn error
6.Medium
Which query returns the number of orders per customer?
- ASELECT customer_id, COUNT(*) FROM orders GROUP BY customer_id
- BSELECT customer_id FROM orders WHERE COUNT(*) > 0
- CSELECT DISTINCT COUNT(*) FROM orders
- DSELECT customer_id, COUNT(*) FROM orders ORDER BY customer_id
7.Hard
What is a phantom read?
- AA repeated query returns new rows inserted by another committed transaction
- BReading data that was never written
- CA query that returns no rows
- DReading uncommitted changes
8.Hard
What does the write-ahead logging (WAL) rule require?
- AEvery query must be logged before it is parsed
- BData pages must be written before the log
- CA change's log record must reach stable storage before the changed data page does
- DThe log is written only after a crash
Answer key
- 1. B · Data Control Language (DCL)
- 2. D · One-to-many
- 3. B · UPDATE
- 4. C · Reading data written by another transaction that has not yet committed
- 5. B · 'unknown'
- 6. A · SELECT customer_id, COUNT(*) FROM orders GROUP BY customer_id
- 7. A · A repeated query returns new rows inserted by another committed transaction
- 8. C · A change's log record must reach stable storage before the changed data page does
Full step-by-step solutions: practise this topic on examproblems.com.