Become a data analyst in 90 days✦27 portfolio projects✦100+ interview Q&As✦1:1 mentor for a year✦See the 90-Day System →✦Become a data analyst in 90 days✦27 portfolio projects✦100+ interview Q&As✦1:1 mentor for a year✦See the 90-Day System →✦
New here? Want every day planned for you? See the 90-Day System →

Free PDF · SQL

How I'd explain SQL to a 5-year-old

12 SQL ideas. One school day. A class register is a table, raising hands is WHERE, and tiffin boxes are a JOIN.

DGSQLSQL explained to a 5-year-old12 ideas@thedataguy16

How I'd explain SQL to a 5-year-old.

A class register is a table. Raising hands is WHERE. Matching tiffin boxes to kids is a JOIN.

If SQL still feels scary, read this once. Then send it to the friend who keeps saying SQL is hard.

Save it for your next revision.

Ideas 1-6

The basics, in class.

Table

Your class register. Each row is one student. Each column is one detail: name, roll no, marks.

FROM students

SELECT

Teacher says: show me only the names and marks. Nothing else.

SELECT name, marks

WHERE

Only kids who scored above 80, raise your hands!

WHERE marks > 80

ORDER BY

Line up from shortest to tallest. Same kids, new order.

ORDER BY height

GROUP BY

Put the toys in boxes by colour. Then look at each box.

GROUP BY colour

COUNT

How many kids came to school today? Count the ticks.

COUNT(*)

Ideas 7-12

Lunch break, the tricky bits.

SUM / AVG

Add up everyone's pocket money. Then share it equally. That's the average.

SUM(money), AVG(money)

JOIN

Match each tiffin box to its kid using the name tag.

JOIN tiffins ON name

LEFT JOIN

Every kid comes to lunch, even the one whose tiffin is missing. He gets an empty plate.

LEFT JOIN tiffins

DISTINCT

Say everyone's favourite ice-cream flavour, but each flavour only once.

SELECT DISTINCT flavour

LIMIT

Only the first 3 kids in line get the swing.

LIMIT 3

NULL

The answer box is empty. Not zero. Nobody knows yet.

WHERE marks IS NULL

Free PDF

SQL explained to a 5-year-old

Download the PDF

Opens in Google Drive. No sign-up.

Keep going

More free PDFs

90-Day System · become a data analyst→