1.Easy
Which constraint makes sure a column can never be left empty (NULL)?
- ANOT NULL
- BUNIQUE
- CCHECK NULL
- DDEFAULT
2.Easy
What is a composite key?
- AA key that is generated by the database
- BA key made up of two or more columns
- CA key stored in a separate table
- DA key that allows duplicate values
3.Easy
What does a CROSS JOIN return?
- AOnly the rows that match on a shared key column
- BOnly rows that do not match
- CThe rows of the first table only
- DEvery combination of rows from the two tables
4.Medium
Which query returns the number of orders per customer?
- ASELECT customer_id, COUNT(*) FROM orders ORDER BY customer_id
- BSELECT customer_id FROM orders WHERE COUNT(*) > 0
- CSELECT DISTINCT COUNT(*) FROM orders
- DSELECT customer_id, COUNT(*) FROM orders GROUP BY customer_id
5.Medium
When is WHERE EXISTS (subquery) true for a row?
- AWhen the subquery returns exactly one row
- BWhen the subquery returns no NULL values
- CWhen the subquery returns at least one row
- DWhen the subquery returns a number greater than zero
6.Medium
What does the "A" in ACID stand for?
- AAtomicity
- BAccuracy
- CAvailability
- DAggregation
7.Hard
Transaction T1 locks row A and waits for row B, while T2 locks row B and waits for row A. What does a typical DBMS do?
- ADetects the deadlock and aborts one transaction as the victim
- BLets both transactions wait until one of them commits normally
- CCommits both transactions at once
- DMerges the two transactions into one
8.Hard
Scores are 90, 90 and 80. Which values does RANK() OVER (ORDER BY score DESC) give?
- A2, 2, 3
- B1, 2, 3
- C1, 1, 3
- D1, 1, 2
Answer key
- 1. A · NOT NULL
- 2. B · A key made up of two or more columns
- 3. D · Every combination of rows from the two tables
- 4. D · SELECT customer_id, COUNT(*) FROM orders GROUP BY customer_id
- 5. C · When the subquery returns at least one row
- 6. A · Atomicity
- 7. A · Detects the deadlock and aborts one transaction as the victim
- 8. C · 1, 1, 3
Full step-by-step solutions: practise this topic on examproblems.com.