1.Easy
How does UNION ALL differ from UNION?
- AUNION ALL sorts the result
- BUNION ALL keeps duplicate rows
- CUNION ALL removes duplicate rows
- DUNION ALL only works on one table
2.Easy
Which statement adds a new column to an existing table?
- AALTER TABLE
- BINSERT COLUMN
- CCREATE COLUMN
- DUPDATE TABLE
3.Easy
What is a primary key?
- AA column that may hold duplicate values but must never contain NULL
- BA password for the database
- CA column or set of columns that uniquely identifies each row
- DThe first column of every table
4.Medium
Table a has 3 rows and table b has 4 rows. How many rows does SELECT * FROM a CROSS JOIN b return?
- A7
- B12
- C4
- D3
5.Medium
Why does SELECT price * 2 AS double_price FROM t WHERE double_price > 10 fail in most databases?
- AWHERE can only compare text columns
- BAliases may not contain an underscore
- CWHERE is evaluated before the SELECT list, so the alias does not exist yet
- DArithmetic is not allowed in the SELECT list
6.Medium
What does GRANT SELECT ON employees TO alice do?
- AMakes alice the owner of the database
- BCopies the employees table to alice
- CAllows the user alice to read the employees table
- DAllows alice to update and delete rows in the employees table
7.Hard
What does SELECT day, SUM(amount) OVER (ORDER BY day) FROM sales compute?
- AOne row per day with that day's total only
- BThe total of all amounts on every row
- CThe average amount per day
- DA running total of amount ordered by day
8.Hard
For an equality join between two large tables with no useful indexes, which join algorithm does an optimiser often choose?
- ACross join
- BBitmap join on the primary key
- CHash join
- DNested loop join with index lookups
Answer key
- 1. B · UNION ALL keeps duplicate rows
- 2. A · ALTER TABLE
- 3. C · A column or set of columns that uniquely identifies each row
- 4. B · 12
- 5. C · WHERE is evaluated before the SELECT list, so the alias does not exist yet
- 6. C · Allows the user alice to read the employees table
- 7. D · A running total of amount ordered by day
- 8. C · Hash join
Full step-by-step solutions: practise this topic on examproblems.com.