Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Preview

DA 2.1: Relational and non-relational stores

This is the first page of the lesson. Read it and have a go at the activities. The rest is in the full lesson.

45 minutes

Two apps, two kinds of store

A school canteen app records who bought which lunch. A music app records songs, photos, likes and friends.

Both keep data. But the data has a different shape. So they do not store it the same way.

Key words

WordWhat it meansExample
Databasean organised store of data that you can search
Tablerows and columns holding one kind of thingpupils
Relational databasetables linked by values they share
Non-relational databasea store shaped to suit the data in it
Documentone record with its own fields, which can be nested
Key-value storea store you search by one id

The cells students fill in are left blank in this preview.

By the end of this lesson

Note

I can say when a relational database or a non-relational database is the better fit.

Starter

Have a go

Starter

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

A relational database links tables

A relational database keeps data in tables. Each table holds one kind of thing, such as pupils or lunches.

Tables share a value, so a lunch can point at the pupil who bought it. The data points relate to each other.

Try it: two linked tables

Code: duckdb
-- Each lunch holds a pupil_id. The query follows it to the pupil.
select pupils.name, lunches.item, lunches.price_pence
from lunches join pupils on pupils.pupil_id = lunches.pupil_id
order by lunches.lunch_id;

-- Try it: add  where pupils.form = '9B'  before the order line.

Check

Have a go

Check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

The lesson goes on

7 more parts of this lesson are in the full curriculum, with the tasks, the final check and the labs. A college account gives your students all of it.