A bike hire shop on paper
Greenfield Bike Hire is a made-up shop with five customers, five bikes and a paper diary. The owner asks you three things.
Who hired which bike? Which type of bike earns the most? How can I show the answer to my staff? You will plan the tables, ask the questions and present the result.
By the end of this lesson
Note
I can plan three linked tables, write a query (a question you ask a table) across them and present the result.
Key words
| Word | What it means |
|---|---|
| Database | an organised collection of data |
| Data dictionary | a table that describes every field |
| Primary key | a field that is different for every record |
| Foreign key | a field that holds a key from another table |
| Query | a question you ask a database |
| Presence check | a check that a field is not empty |
| Range check | a check that a number is between two limits |
| Format check | a check that data follows a set pattern |
| Audience | the people who will read or watch |
The cells students fill in are left blank in this preview.
Starter: what you already know
Have a go
Starter: what you already know
4 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.
Step 1: the data dictionary
| Table | Field | Type | Rule or key |
|---|---|---|---|
| customers | customer_id | Whole number | Primary key |
| customers | last_name | Alphabetic | Presence check |
| customers | phone | Alphanumeric, 11 characters | Format check, starts 07 |
| bikes | bike_id | Whole number | Primary key |
| bikes | bike_type | Alphabetic | List check: Road, Mountain, City |
| hires | hire_id | Whole number | Primary key |
| hires | customer_id and bike_id | Whole number | Foreign keys |
| hires | days | Whole number | Range check, 1 to 14 |
The cells students fill in are left blank in this preview.
Check
Have a go
Check
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.