Worked example · Science · Year 7

Database queries for planets

DCF: Data and computational thinking → Data and information literacy

What this is

Every answer, worked from Table 1 on the worksheet, with the pupil's reasoning written out. You can mark the class from this page without knowing any astronomy: each answer names the records it came from. The figures are NASA Planetary Fact Sheet values.

About this database

How many fields?Seven: Planet, Diameter_km, Distance_from_Sun_million_km, Orbital_Period_days, Number_of_Moons, Mean_Temperature_C, Has_Rings.
How many records?Eight — one per planet.
Which field holds text?Planet. It is the only field you cannot do arithmetic on.
Which field is only ever Yes or No?Has_Rings. That is a Boolean field, so it can only hold one of two values.
Which field contains negative numbers?Mean_Temperature_C. Five planets are below zero, so sorting it puts Neptune (−200 °C) below Uranus (−195 °C) — if the computer treated them as text, "−195" would sort before "−200" and the order would be wrong.
Best unique key?Planet, because no two records share a name. No numeric field is guaranteed unique — Mercury and Venus both have 0 moons.

Meets criteria 1 and 2: the vocabulary is used accurately and the data types are justified, including why the negative temperatures matter to a sort.

The six queries, answered

No. Query Answer
1 Sort by Diameter_km, smallest first. Mercury is first at 4,879 km; Jupiter is last at 142,984 km. Full order: Mercury 4,879, Mars 6,792, Venus 12,104, Earth 12,756, Neptune 49,528, Uranus 51,118, Saturn 120,536, Jupiter 142,984.
2 Filter Number_of_Moons > 2. Four records match: Jupiter (95), Saturn (274), Uranus (28) and Neptune (16). Mars has exactly 2, so it fails a "greater than 2" test; Earth has 1; Mercury and Venus have none.
3 Filter Distance < 250 AND Mean_Temperature > 0. Three records: Mercury (57.9, 167 °C), Venus (108.2, 464 °C) and Earth (149.6, 15 °C). Mars is inside 250 million km at 228.0, but its mean temperature is −65 °C, so it fails the second condition and is excluded.
4 Sort by Orbital_Period_days, largest first. Neptune has the longest year at 59,800 days — about 164 Earth years. Then Uranus 30,589, Saturn 10,747, Jupiter 4,331.
5 Search for the shortest year. Mercury, 88.0 days. It is the closest planet to the Sun, so it has the shortest distance to travel round.
6 Filter Has_Rings = Yes AND Number_of_Moons < 30. Two records: Uranus (28 moons) and Neptune (16 moons). Jupiter and Saturn have rings but 95 and 274 moons, so they fail the second condition.

Meets criteria 3 and 4: each filter lists every match, each two-condition filter names the record that was rejected and why, and every value can be traced back to Table 1.

The three functions

=SUM(E2:E9) → 416
=AVERAGE(E2:E9) → 52
=MEDIAN(E2:E9) → 9

Working: 0 + 0 + 1 + 2 + 95 + 274 + 28 + 16 = 416 moons altogether. 416 ÷ 8 = 52, which is the mean. Put the eight values in order — 0, 0, 1, 2, 16, 28, 95, 274 — and the middle falls between the 4th and 5th values, so the median is (2 + 16) ÷ 2 = 9.

Which average is better? The median, 9. Six of the eight planets have fewer than 20 moons, so no planet is anywhere near the mean of 52. Saturn's 274 and Jupiter's 95 drag the mean upwards on their own. Saying "a typical planet has 52 moons" would be true arithmetic and a false statement about the Solar System.

Meets criterion 5, which is the real data literacy point of this lesson: a correctly calculated statistic can still describe the data badly.

Two of the pupil's own queries

Query A: filter Diameter_km > 100000. — Two records: Jupiter (142,984 km) and Saturn (120,536 km).

Query B: filter Has_Rings = No AND Orbital_Period_days < 400. — Three records: Mercury (88.0), Venus (224.7) and Earth (365.2). Mars has no rings but its year is 687.0 days, so it is excluded.

Both queries are testable against the table, and the second one uses two conditions with a record that fails only one of them — the same trap as query 3.

The surprising answer

The hottest planet is Venus at 464 °C, even though Mercury is nearly twice as close to the Sun (57.9 million km against 108.2 million km) and reaches only 167 °C. Venus has a thick carbon dioxide atmosphere that traps heat, and Mercury has almost no atmosphere at all — but that field is not in this database. Sorting on Distance_from_Sun would have made me predict Mercury, so one field on its own can point you at the wrong answer; you need to know what is missing from the table as well as what is in it.

This is the strongest part of the response: it reads the data correctly and then states the limit of the dataset rather than inventing an explanation from it.

Why this response is secure