1.Easy
What does UNION do with the results of two SELECT queries?
- AKeeps only rows that appear in both
- BJoins them side by side on a key
- CKeeps only rows that appear in the first query but not the second
- DCombines them into one result and removes duplicate rows
2.Easy
Which constraint makes sure a column can never be left empty (NULL)?
- ADEFAULT
- BUNIQUE
- CNOT NULL
- DCHECK NULL
3.Easy
Which SQL statement adds new rows to a table?
- AALTER
- BINSERT
- CSELECT
- DUPDATE
4.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 phantom read
- BAn update anomaly
- CA deletion anomaly
- DAn insertion anomaly
5.Medium
A column holds the values 10, 20 and NULL. What does AVG(col) return?
- A30
- B10
- C15
- DNULL
6.Medium
First normal form (1NF) requires that:
- AEvery table has exactly one column
- BEvery non-key column depends on the whole key and on nothing but the key
- CThere are no foreign keys
- DEach column contains atomic values and there are no repeating groups
7.Hard
When is decomposing R into R1 and R2 guaranteed to be lossless?
- AWhen R1 and R2 have no attributes in common
- BWhen R1 and R2 have the same number of columns
- CWhen every attribute of R appears in both R1 and R2
- DWhen the common attributes of R1 and R2 form a superkey of R1 or of R2
8.Hard
Why is NATURAL JOIN considered risky in production queries?
- AIt is not supported by any database
- BIt ignores primary and foreign keys and keeps only NULL rows
- CIt joins on every column with the same name, so a new column can silently change the result
- DIt always returns a Cartesian product
Answer key
- 1. D · Combines them into one result and removes duplicate rows
- 2. C · NOT NULL
- 3. B · INSERT
- 4. B · An update anomaly
- 5. C · 15
- 6. D · Each column contains atomic values and there are no repeating groups
- 7. D · When the common attributes of R1 and R2 form a superkey of R1 or of R2
- 8. C · It joins on every column with the same name, so a new column can silently change the result
Full step-by-step solutions: practise this topic on examproblems.com.