1.Easy
In a LIKE pattern, what does the % wildcard stand for?
- AExactly one character in that position of the string
- BThe end of the string
- CAny sequence of zero or more characters
- DAny single digit
2.Easy
Which keyword sorts the result of a query?
- AORDER BY
- BGROUP BY
- CARRANGE
- DSORT
3.Easy
What does UNION do with the results of two SELECT queries?
- ACombines them into one result and removes duplicate rows
- BKeeps only rows that appear in both
- CJoins them side by side on a key
- DKeeps only rows that appear in the first query but not the second
4.Medium
Students can take many courses and courses have many students. How is this modelled in tables?
- AWith a foreign key column course_id in the students table pointing to courses
- BWith a list of course ids stored in one column
- CBy merging students and courses into one table
- DWith a junction table holding foreign keys to both students and courses
5.Medium
A table stores the customer's address on every order row. Changing the address in one row but not in the others is an example of:
- AAn insertion anomaly
- BA phantom read
- CAn update anomaly
- DA deletion anomaly
6.Medium
In relational algebra, the selection operator (σ) corresponds to which SQL clause?
- AGROUP BY
- BSELECT list
- CORDER BY
- DWHERE
7.Hard
When is decomposing R into R1 and R2 guaranteed to be lossless?
- AWhen R1 and R2 have the same number of columns
- BWhen every attribute of R appears in both R1 and R2
- CWhen R1 and R2 have no attributes in common
- DWhen the common attributes of R1 and R2 form a superkey of R1 or of R2
8.Hard
What does SELECT day, SUM(amount) OVER (ORDER BY day) FROM sales compute?
- AThe total of all amounts on every row
- BThe average amount per day
- COne row per day with that day's total only
- DA running total of amount ordered by day
Answer key
- 1. C · Any sequence of zero or more characters
- 2. A · ORDER BY
- 3. A · Combines them into one result and removes duplicate rows
- 4. D · With a junction table holding foreign keys to both students and courses
- 5. C · An update anomaly
- 6. D · WHERE
- 7. D · When the common attributes of R1 and R2 form a superkey of R1 or of R2
- 8. D · A running total of amount ordered by day
Full step-by-step solutions: practise this topic on examproblems.com.