Color theme
0 day streak0 XPP1
SQLLearn mode
MISSION 1 OF 1

Count workshop bookings

0 XP earned
SQL track: BeginnerMission: IntermediateGROUP BYAggregate countsHAVING
Before you start this beginner track

Tables, rows, and columns. Start with SELECT before grouped queries.

Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.

x
0 / 2 challenges
LEARN THE CONCEPT

Understand it, then try it.

A library groups workshop bookings by topic to see which sessions have enough participants. COUNT(*) counts rows in each group. HAVING filters these grouped results after aggregation, while WHERE filters individual rows before grouping. The booked alias makes it easier to sort the retained topics by their booking counts.

quest.sql
WITH bookings(topic, attendee) AS (    VALUES ('Drawing', 'Ari'), ('Robots', 'Bo'),           ('Drawing', 'Cy'), ('Robots', 'Dee'),           ('Robots', 'Eli'), ('Poetry', 'Fox'))SELECT topic, COUNT(*) AS bookedFROM bookingsGROUP BY topicHAVING COUNT(*) >= 2ORDER BY booked DESC, topic ASC;

Run each query independently in SQLite 3. VALUES inside a common table expression supplies all data, so no tables or database setup are needed. Quiz outputs show data rows only, with | between columns and no headers.

Track the values line by line. Predict the result before running this example in your own editor.