Kodewick
Start learning →
Basic←→0 / 70

Seats each day

#030BasicGROUP BYAggregates4 min

The manager wants to know how many seats were sold on each day of the weekend. Group the tickets table by day, one row per day: day first, then that day's seats added up.

The tables
movies
idtitlegenreminutesrating
1Robot Summerfamily958
2Dark Lakehorror1106
3Space Palsfamily887
4The Long Roaddrama1429
5Laugh Trackcomedy1015
6Snow Daycomedy927
6 rows
tickets
idmovie_iddayseatsprice
11Fri240
21Sat480
32Fri125
43Sat354
54Sun260
61Sun120
75Sat236
83Sun590
8 rows
query.sql
-- your code here: make the second column SUM(seats), and group by day
SELECT day, seats
FROM tickets;
Ctrl + Enter runs too
Result

Run shows what your query gives. When it looks right, Submit.