1.Easy
Which SQL statement adds new rows to a table?
- AUPDATE
- BINSERT
- CALTER
- DSELECT
2.Easy
What does NULL represent in SQL?
- AA false Boolean
- BA missing or unknown value
- CThe number zero in numeric columns
- DAn empty string
3.Easy
What does a UNIQUE constraint on a column guarantee?
- AThe column automatically becomes the primary key of the table
- BNo two rows have the same non-NULL value in that column
- CThe column cannot be changed after insert
- DThe column values are sorted
4.Medium
What does GRANT SELECT ON employees TO alice do?
- ACopies the employees table to alice
- BMakes alice the owner of the database
- CAllows the user alice to read the employees table
- DAllows alice to update and delete rows in the employees table
5.Medium
What does SELECT COALESCE(phone, 'unknown') FROM customers return for a customer whose phone is NULL?
- A'unknown'
- BAn empty string
- CAn error
- DNULL
6.Medium
In relational algebra, the projection operator (π) corresponds to:
- AChoosing which columns appear in the result
- BCombining two tables on a key
- CChoosing which rows satisfy a given condition
- DSorting the result
7.Hard
After customers LEFT JOIN orders, why use COUNT(o.id) rather than COUNT(*) to count orders per customer?
- ACOUNT(*) is not allowed after a join
- BCOUNT(*) ignores rows with NULL values
- CCOUNT(o.id) counts only distinct customers
- DCOUNT(*) counts the NULL-filled row as 1 for customers without orders
8.Hard
For an equality join between two large tables with no useful indexes, which join algorithm does an optimiser often choose?
- ANested loop join with index lookups
- BCross join
- CHash join
- DBitmap join on the primary key
Answer key
- 1. B · INSERT
- 2. B · A missing or unknown value
- 3. B · No two rows have the same non-NULL value in that column
- 4. C · Allows the user alice to read the employees table
- 5. A · 'unknown'
- 6. A · Choosing which columns appear in the result
- 7. D · COUNT(*) counts the NULL-filled row as 1 for customers without orders
- 8. C · Hash join
Full step-by-step solutions: practise this topic on examproblems.com.