1.Easy
Which statement removes rows from a table?
- ADROP
- BDELETE
- CTRUNCATE COLUMN
- DREMOVE
2.Easy
Which SQL statement retrieves data from a table?
- AUPDATE
- BINSERT
- CSELECT
- DCREATE
3.Easy
In a LIKE pattern, what does the % wildcard stand for?
- AThe end of the string
- BAny sequence of zero or more characters
- CExactly one character in that position of the string
- DAny single digit
4.Medium
What does GRANT SELECT ON employees TO alice do?
- AMakes alice the owner of the database
- BCopies the employees table to alice
- CAllows alice to update and delete rows in the employees table
- DAllows the user alice to read the employees table
5.Medium
Which statement removes all rows of a table, keeps its structure and cannot take a WHERE clause?
- ADROP TABLE
- BALTER TABLE
- CTRUNCATE TABLE
- DDELETE FROM with a WHERE clause
6.Medium
A view in SQL is:
- AA copy of a table on disk
- BA stored query that behaves like a virtual table
- CA screen in the database client for browsing tables
- DAn index type
7.Hard
What does SELECT day, SUM(amount) OVER (ORDER BY day) FROM sales compute?
- AA running total of amount ordered by day
- BOne row per day with that day's total only
- CThe average amount per day
- DThe total of all amounts on every row
8.Hard
After customers LEFT JOIN orders, why use COUNT(o.id) rather than COUNT(*) to count orders per customer?
- ACOUNT(o.id) counts only distinct customers
- BCOUNT(*) ignores rows with NULL values
- CCOUNT(*) counts the NULL-filled row as 1 for customers without orders
- DCOUNT(*) is not allowed after a join
Answer key
- 1. B · DELETE
- 2. C · SELECT
- 3. B · Any sequence of zero or more characters
- 4. D · Allows the user alice to read the employees table
- 5. C · TRUNCATE TABLE
- 6. B · A stored query that behaves like a virtual table
- 7. A · A running total of amount ordered by day
- 8. C · COUNT(*) counts the NULL-filled row as 1 for customers without orders
Full step-by-step solutions: practise this topic on examproblems.com.