Northstar Learning › Coding course

Learn SQL by doing

300 quests · queries, filtering, aggregates, grouping and joins · SQLite

300 questions · free · no account needed · works offline once loaded

Start learningTry today’s daily challenge

What you will cover

Try some questions

Tap a question to see the answer and why.

Which replacement returns the battery rows at or below 10?
devices
id | name | room | battery
1 | Oak | Kitchen | 3
2 | Fern | Bedroom | 10
3 | Pine | Kitchen | 17
4 | Reed | Study | NULL
5 | Moss | Bedroom | 24
6 | Ash | Hall | 8

SELECT name FROM devices
MISSING
ORDER BY id;

Options: WHERE battery = NULL · HAVING battery < 10 · WHERE battery > 10 · WHERE battery <= 10

Answer: WHERE battery <= 10

WHERE filters rows before anything is grouped. Here the query returns: Oak / Fern / Ash.

Which replacement returns the age rows at or below 6?
pets
id | name | species | age
1 | Rex | Dog | 4
2 | Tom | Cat | 9
3 | Bella | Dog | 12
4 | Pip | Bird | NULL
5 | Luna | Cat | 2
6 | Coco | Rabbit | 6

SELECT name FROM pets
MISSING
ORDER BY id;

Options: WHERE age = NULL · HAVING age < 6 · WHERE age > 6 · WHERE age <= 6

Answer: WHERE age <= 6

WHERE filters rows before anything is grouped. Here the query returns: Rex / Luna / Coco.

Which replacement returns the height rows at or below 30?
plants
id | plant | zone | height
1 | Mint | Shade | 15
2 | Basil | Sun | 30
3 | Fern | Shade | 45
4 | Sage | Sun | NULL
5 | Thyme | Sun | 12
6 | Ivy | Wall | 60

SELECT plant FROM plants
MISSING
ORDER BY id;

Options: WHERE height = NULL · HAVING height < 30 · WHERE height > 30 · WHERE height <= 30

Answer: WHERE height <= 30

WHERE filters rows before anything is grouped. Here the query returns: Mint / Basil / Thyme.

Which replacement keeps only rows whose room is Bedroom?
devices
id | name | room | battery
1 | Oak | Kitchen | 3
2 | Fern | Bedroom | 10
3 | Pine | Kitchen | 17
4 | Reed | Study | NULL
5 | Moss | Bedroom | 24
6 | Ash | Hall | 8

SELECT name FROM devices
MISSING
ORDER BY name;

Options: WHERE room = Bedroom · WHERE room != 'Bedroom' · WHERE room = 'Study' · WHERE room = 'Bedroom'

Answer: WHERE room = 'Bedroom'

WHERE filters rows before anything is grouped. Here the query returns: Fern / Moss.

Which replacement keeps only rows whose species is Cat?
pets
id | name | species | age
1 | Rex | Dog | 4
2 | Tom | Cat | 9
3 | Bella | Dog | 12
4 | Pip | Bird | NULL
5 | Luna | Cat | 2
6 | Coco | Rabbit | 6

SELECT name FROM pets
MISSING
ORDER BY name;

Options: WHERE species = Cat · WHERE species != 'Cat' · WHERE species = 'Bird' · WHERE species = 'Cat'

Answer: WHERE species = 'Cat'

WHERE filters rows before anything is grouped. Here the query returns: Luna / Tom.

Which replacement keeps only rows whose zone is Sun?
plants
id | plant | zone | height
1 | Mint | Shade | 15
2 | Basil | Sun | 30
3 | Fern | Shade | 45
4 | Sage | Sun | NULL
5 | Thyme | Sun | 12
6 | Ivy | Wall | 60

SELECT plant FROM plants
MISSING
ORDER BY plant;

Options: WHERE zone = Sun · WHERE zone != 'Sun' · WHERE zone = 'Wall' · WHERE zone = 'Sun'

Answer: WHERE zone = 'Sun'

WHERE filters rows before anything is grouped. Here the query returns: Basil / Sage / Thyme.

Which replacement finds the rows where battery is missing?
devices
id | name | room | battery
1 | Oak | Kitchen | 3
2 | Fern | Bedroom | 10
3 | Pine | Kitchen | 17
4 | Reed | Study | NULL
5 | Moss | Bedroom | 24
6 | Ash | Hall | 8

SELECT name FROM devices
MISSING
ORDER BY id;

Options: WHERE battery = NULL · WHERE battery = 0 · WHERE battery IS NOT NULL · WHERE battery IS NULL

Answer: WHERE battery IS NULL

WHERE filters rows before anything is grouped. Here the query returns: Reed.

Which replacement finds the rows where age is missing?
pets
id | name | species | age
1 | Rex | Dog | 4
2 | Tom | Cat | 9
3 | Bella | Dog | 12
4 | Pip | Bird | NULL
5 | Luna | Cat | 2
6 | Coco | Rabbit | 6

SELECT name FROM pets
MISSING
ORDER BY id;

Options: WHERE age = NULL · WHERE age = 0 · WHERE age IS NOT NULL · WHERE age IS NULL

Answer: WHERE age IS NULL

WHERE filters rows before anything is grouped. Here the query returns: Pip.

Play with friends

Northstar also has a group quiz: host a live room, run one on a single screen, or send a friend a challenge link.

Open the group quiz