Final exam
Database Design Basics
Before you start
- 20 questions, drawn at random from a pool of 33.
- Pass mark: 70%. Your final score is 30% practice + 70% exam.
- No time limit, but finish within 3 hours. You can move between questions before you submit.
- Failed? Review the lessons and try again: every attempt gets a new set of questions.
Question 1 of 20Choose one
A shop stores each order in one spreadsheet row that includes the customer's full address. A customer moves, and only some of their rows are updated. What is the root cause?
Question 2 of 20True or false
In a relational table, rows have a guaranteed built-in order, so results always come back in insertion order.
Question 3 of 20Choose one
Which column is the poorest choice for a primary key in an employee table?
Question 4 of 20Match the pairs
Match each value to the most appropriate SQL data type.
Tap an answer, then tap the place where it belongs (or drag it there).
- An invoice amount such as 1249.99
- A US ZIP code such as 02134
- A delivery date
- Number of items in a cart
Question 5 of 20Work it out
A table's score column holds 10, 6, NULL and 8. What does AVG(score) return?
Question 6 of 20Fill in the blanks
Fill in the blanks
To find customers with no phone number recorded, write WHERE phone , because phone = NULL is never true.
Question 7 of 20Sort into groups
Classify each item from a library system's requirements.
Tap an item, then tap its group (or drag it there).
Question 8 of 20Choose one
A customer can have several delivery addresses. In an ER model, the addresses are which kind of attribute?
Question 9 of 20Sort into groups
Classify each relationship by cardinality.
Tap an item, then tap its group (or drag it there).
Question 10 of 20Choose one
On a crow's foot diagram, the end of a line touching ORDER shows a bar and a crow's foot, and you are reading from CUSTOMER. What does it mean?
Question 11 of 20What would you do?
What would you do?
A hospital records which nurses work which shifts. Nurses work many shifts and each shift has many nurses. The hospital also wants to record each nurse's role on each shift (lead or support). How should this be modeled?
Question 12 of 20Choose one
When mapping a one-to-many relationship between Department (one) and Employee (many), where does the foreign key go?
Question 13 of 20Match the pairs
Match each foreign key option to the best use case.
Tap an answer, then tap the place where it belongs (or drag it there).
- ON DELETE CASCADE
- ON DELETE RESTRICT
- ON DELETE SET NULL
Question 14 of 20Work it out
A design has 5 entities connected by 4 one-to-many relationships and 2 many-to-many relationships. After mapping, how many tables are there?
Question 15 of 20True or false
A table with a single-column primary key can still violate third normal form.
Question 16 of 20Match the pairs
Match each anomaly to its example in a table that stores enrollments with course details.
Tap an answer, then tap the place where it belongs (or drag it there).
- Insert anomaly
- Update anomaly
- Delete anomaly
Question 17 of 20Choose one
In a table with columns (isbn, title, publisher_id, publisher_name), which functional dependency causes a transitive dependency if isbn is the key?
Question 18 of 20Spot the mistake
A classmate wrote these statements about normal forms. Tap the two that are wrong.
Question 19 of 20Work it out
A flat table has key (student_id, course_code) and these dependencies: student_id → student_name, major; course_code → title, credits, dept_id; dept_id → dept_name; (student_id, course_code) → grade. How many tables does a 3NF design have?
Question 20 of 20Put in order
Order these normal forms from weakest to strictest.
Drag the items, or use the arrow buttons, to put them in order.
- Boyce-Codd normal form
- First normal form
- Second normal form
- Third normal form
Question 21 of 20What would you do?
What would you do?
A data analytics team builds a reporting database loaded every night from the normalized order system. Queries join seven tables and run slowly. What is a reasonable approach?
Question 22 of 20Fill in the blanks
Fill in the blanks
In SQL, the statement that creates a new table is , and the statement that adds a column to an existing table is .
Question 23 of 20Choose one
Which constraint stops a hotel from booking the same room twice on the same night?
Question 24 of 20Spot the mistake
Tap the two lines of this table definition that contain design errors.
Question 25 of 20Work it out
A store has 200 customers, of whom 150 have placed orders; there are 600 orders in total. How many rows does customer INNER JOIN orders return?
Question 26 of 20Choose one
A query needs every product, including those never sold, with the number of times each was sold. Which approach is correct?
Question 27 of 20True or false
A condition such as SUM(quantity) > 50 belongs in the HAVING clause rather than the WHERE clause.
Question 28 of 20Work it out
A B-tree index has a fan-out of 300. What is the smallest number of levels needed to index 20 million rows?
Question 29 of 20Select all that apply
A table has a composite index on (country, city). Which queries can use it efficiently? Select all that apply.
Select all that apply.
Question 30 of 20Choose one
What is the main cost of adding many indexes to a table?
Question 31 of 20Match the pairs
Match each ACID property to its meaning.
Tap an answer, then tap the place where it belongs (or drag it there).
- Atomicity
- Consistency
- Isolation
- Durability
Question 32 of 20What would you do?
What would you do?
A bank transfer moves $200 from account A to account B with two UPDATE statements. The server crashes after the first one. How should the system be designed so money is never lost?
Question 33 of 20Select all that apply
Which of these are common database design smells? Select all that apply.
Select all that apply.