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

Preview

Unit 9 A1, B1, C1: Review: analyse, show and look after data

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

60 minutes

A cafe that wants to know

Sunrise Cafe is a made-up cafe with four drinks and a week of orders. The owner asks three things.

Which drink earns the most? Should I put more effort into takeaway or eat in? How do I keep this data in good order? You will plan, ask, show and look after.

By the end of this lesson

Note

I can plan an analysis, make a report, lay out a dashboard and plan its upkeep for one organisation.

Key words

WordWhat it meansExample
Information requirementwhat the reader needs to know, and why
Querya question you ask a table of data
Aggregate functiona function that adds up or counts many recordsSUM
Dashboardone screen that shows key numbers and charts
Schedulea plan that says what is done, by whom and how often
Backupa spare copy of data kept in case of loss
Archiveto move old data to separate storage

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 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.

Step 1: write the information requirement

Start with the question and not the chart. Write down the problem, who needs the answer, what they will decide, and which data you need.

Then check that the data exists and who may see it. Only then write a query.

The requirement for Sunrise Cafe

PartSunrise Cafe
ProblemThe owner does not know which drinks earn the most
ReaderThe owner, who is busy and wants one page
DecisionWhich drinks to promote
Data neededdrinks and orders tables
Who may see itThe owner and the manager only

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

Step 2: make the report

Code: sql
-- Revenue for each drink, biggest first. One # is 3 pounds.
SELECT drinks.drink_name AS Drink,
       SUM(drinks.price * orders.quantity) AS Revenue,
       REPLACE(HEX(ZEROBLOB(SUM(drinks.price * orders.quantity) / 3)), '00', '#') AS Chart
FROM orders
JOIN drinks ON orders.drink_id = drinks.drink_id
GROUP BY drinks.drink_id
ORDER BY Revenue DESC, Drink;

-- Add a WHERE orders.place = 'Takeaway' line before GROUP BY and run it again.

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

9 more parts of this lesson are in the full lesson, which colleges teach from the Library. A college account gives your students all of it.