1.Easy
In a LIKE pattern, what does the _ (underscore) wildcard stand for?
- AA space character
- BExactly one character
- CAny letter but no digits
- DZero or more characters
2.Easy
Which statement deletes a whole table, including its structure?
- ADELETE FROM
- BDROP TABLE
- CREMOVE TABLE
- DTRUNCATE ROWS
3.Easy
What is a composite key?
- AA key stored in a separate table
- BA key that is generated by the database
- CA key made up of two or more columns
- DA key that allows duplicate values
4.Medium
What does the functional dependency A → B mean?
- AA is a foreign key referencing B
- BA and B are both primary keys
- CEach value of B is associated with exactly one value of A
- DEach value of A is associated with exactly one value of B
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
What does EXCEPT (called MINUS in Oracle) return?
- ARows of the second query that do not appear in the first one
- BRows of the first query that do not appear in the second
- CAll rows from both queries without duplicates
- DRows that appear in both queries
7.Hard
What does EXPLAIN (or EXPLAIN ANALYZE in PostgreSQL) show for a query?
- AThe list of users who ran the query
- BThe meaning of each SQL keyword in the query
- CThe execution plan chosen by the optimiser, such as scans and join methods
- DA rewrite of the query in relational algebra notation only
8.Hard
What does the following return: SELECT name FROM students WHERE grade > (SELECT AVG(grade) FROM students)?
- AAn error because subqueries are not allowed in WHERE
- BStudents with the highest grade only
- CStudents with a grade above the average grade
- DThe average grade of all students
Answer key
- 1. B · Exactly one character
- 2. B · DROP TABLE
- 3. C · A key made up of two or more columns
- 4. D · Each value of A is associated with exactly one value of B
- 5. A · SELECT customer_id, COUNT(*) FROM orders GROUP BY customer_id
- 6. B · Rows of the first query that do not appear in the second
- 7. C · The execution plan chosen by the optimiser, such as scans and join methods
- 8. C · Students with a grade above the average grade
Full step-by-step solutions: practise this topic on examproblems.com.