1.Easy
In PostgreSQL and MySQL, which clause returns only the first 10 rows of a result?
- AFIRST 10 ONLY
- BMAX 10
- CLIMIT 10
- DTOP ROWS 10
2.Easy
Which keyword gives a column or table a temporary alternative name in a query?
- AAS
- BALIAS
- CRENAME
- DNAME
3.Easy
What does GROUP BY do in a query?
- APuts rows with the same values into groups so aggregates are computed per group
- BJoins two tables on their common columns
- CRemoves rows with NULL values
- DSorts the rows of the result alphabetically
4.Medium
Table a has 3 rows and table b has 4 rows. How many rows does SELECT * FROM a CROSS JOIN b return?
- A4
- B3
- C7
- D12
5.Medium
Which statement about HAVING is correct?
- AIt can use aggregate functions to filter groups
- BIt must come before WHERE in the SELECT statement
- CIt sorts the results
- DIt cannot be used with GROUP BY
6.Medium
A view in SQL is:
- AAn index type
- BA stored query that behaves like a virtual table
- CA screen in the database client for browsing tables
- DA copy of a table on disk
7.Hard
What does SELECT day, SUM(amount) OVER (ORDER BY day) FROM sales compute?
- AA running total of amount ordered by day
- BThe total of all amounts on every row
- CThe average amount per day
- DOne row per day with that day's total only
8.Hard
What is a known drawback of decomposing tables into BCNF compared with 3NF?
- ABCNF tables cannot have primary keys
- BThe decomposition always loses data when joined back
- CBCNF allows more redundancy than 3NF
- DSome functional dependencies may no longer be checkable within a single table
Answer key
- 1. C · LIMIT 10
- 2. A · AS
- 3. A · Puts rows with the same values into groups so aggregates are computed per group
- 4. D · 12
- 5. A · It can use aggregate functions to filter groups
- 6. B · A stored query that behaves like a virtual table
- 7. A · A running total of amount ordered by day
- 8. D · Some functional dependencies may no longer be checkable within a single table
Full step-by-step solutions: practise this topic on examproblems.com.