For teachers: free to print, copy and use in class. Every new worksheet has new values and its own answer key. A link to ExamProblems on your course page is appreciated.
Name: ____________________ Date: ____________
1.Easy
Which operator is used for simple text pattern matching in a WHERE clause?
ACONTAINS
BMATCH
CSIMILAR
DLIKE
2.Easy
What does UNION do with the results of two SELECT queries?
AJoins them side by side on a key
BKeeps only rows that appear in both
CKeeps only rows that appear in the first query but not the second
DCombines them into one result and removes duplicate rows
3.Easy
What is a primary key?
AA password for the database
BThe first column of every table
CA column or set of columns that uniquely identifies each row
DA column that may hold duplicate values but must never contain NULL
4.Medium
Third normal form (3NF) removes:
ARedundant indexes on columns that are not part of a key
BAtomic values
CComposite keys
DTransitive dependencies between non-key attributes
5.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
6.Medium
What does the functional dependency A → B mean?
AA and B are both primary keys
BEach value of A is associated with exactly one value of B
CA is a foreign key referencing B
DEach value of B is associated with exactly one value of A
7.Hard
For an equality join between two large tables with no useful indexes, which join algorithm does an optimiser often choose?
ABitmap join on the primary key
BCross join
CHash join
DNested loop join with index lookups
8.Hard
Table b contains the values 1, 2 and NULL in column y. What does SELECT * FROM a WHERE x NOT IN (SELECT y FROM b) return?
AOnly rows of a where x is NULL
BEvery row of a
CRows of a where x is not 1 or 2
DNo rows at all
Answer key
1. D · LIKE
2. D · Combines them into one result and removes duplicate rows
3. C · A column or set of columns that uniquely identifies each row
4. D · Transitive dependencies between non-key attributes
5. D · With a junction table holding foreign keys to both students and courses
6. B · Each value of A is associated with exactly one value of B
7. C · Hash join
8. D · No rows at all
Full step-by-step solutions: practise this topic on examproblems.com.