1.Easy
An INNER JOIN returns:
- AOnly rows with matching values in both tables
- BAll rows from the left table, with NULLs where there is no match
- CRows that do not match
- DAll rows from both tables
2.Easy
Which statement removes rows from a table?
- AREMOVE
- BTRUNCATE COLUMN
- CDROP
- DDELETE
3.Easy
Which rows does WHERE price BETWEEN 10 AND 20 select?
- ARows with price outside the range 10 to 20
- BRows with price from 10 to 20, including 10 and 20
- CRows with price equal to 10 or 20 only
- DRows with price above 10 and below 20, excluding 10 and 20
4.Medium
Which query returns the number of different cities in the customers table?
- ASELECT COUNT(DISTINCT city) FROM customers
- BSELECT SUM(DISTINCT city) FROM customers
- CSELECT COUNT(city) FROM customers GROUP BY city
- DSELECT DISTINCT COUNT(city) FROM customers
5.Medium
Which query returns the number of orders per customer?
- ASELECT customer_id, COUNT(*) FROM orders GROUP BY customer_id
- BSELECT DISTINCT COUNT(*) FROM orders
- CSELECT customer_id, COUNT(*) FROM orders ORDER BY customer_id
- DSELECT customer_id FROM orders WHERE COUNT(*) > 0
6.Medium
Why can a table have only one clustered index?
- AThe rows can be stored physically in only one order
- BClustered indexes can only be on the primary key
- CClustered indexes use too much memory
- DThe SQL standard forbids more than one index on a 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
- CA running total of amount ordered by day
- DThe average amount per day
8.Hard
What is a known drawback of decomposing tables into BCNF compared with 3NF?
- ASome functional dependencies may no longer be checkable within a single table
- BThe decomposition always loses data when joined back
- CBCNF allows more redundancy than 3NF
- DBCNF tables cannot have primary keys
Answer key
- 1. A · Only rows with matching values in both tables
- 2. D · DELETE
- 3. B · Rows with price from 10 to 20, including 10 and 20
- 4. A · SELECT COUNT(DISTINCT city) FROM customers
- 5. A · SELECT customer_id, COUNT(*) FROM orders GROUP BY customer_id
- 6. A · The rows can be stored physically in only one order
- 7. C · A running total of amount ordered by day
- 8. A · Some functional dependencies may no longer be checkable within a single table
Full step-by-step solutions: practise this topic on examproblems.com.