1.Easy
What does a CHECK constraint do?
- ARejects rows whose values do not satisfy a condition
- BChecks whether a table exists before a query is run on it
- CVerifies the user's password
- DCounts the rows in a table
2.Easy
What does a UNIQUE constraint on a column guarantee?
- AThe column cannot be changed after insert
- BThe column values are sorted
- CThe column automatically becomes the primary key of the table
- DNo two rows have the same non-NULL value in that column
3.Easy
Which clause filters rows before grouping?
- AWHERE
- BORDER BY
- CGROUP BY
- DHAVING
4.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
5.Medium
A table stores the customer's address on every order row. Changing the address in one row but not in the others is an example of:
- AA deletion anomaly
- BAn update anomaly
- CA phantom read
- DAn insertion anomaly
6.Medium
In relational algebra, the projection operator (π) corresponds to:
- ASorting the result
- BCombining two tables on a key
- CChoosing which rows satisfy a given condition
- DChoosing which columns appear in the result
7.Hard
Two transactions both read stock = 10, each subtracts 1 and writes the result, giving 9 instead of 8. Which anomaly is this?
- ALost update
- BPhantom read
- CDeletion anomaly
- DDirty read
8.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?
- ALets both transactions wait until one of them commits normally
- BDetects the deadlock and aborts one transaction as the victim
- CMerges the two transactions into one
- DCommits both transactions at once
Answer key
- 1. A · Rejects rows whose values do not satisfy a condition
- 2. D · No two rows have the same non-NULL value in that column
- 3. A · WHERE
- 4. D · Join the employees table with itself using two aliases
- 5. B · An update anomaly
- 6. D · Choosing which columns appear in the result
- 7. A · Lost update
- 8. B · Detects the deadlock and aborts one transaction as the victim
Full step-by-step solutions: practise this topic on examproblems.com.