Find open observatories
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.
Predict the result.
Which names are returned, from top to bottom?
WITH sites(name, open_now) AS ( VALUES ('Mesa', 1), ('Delta', 0), ('Cedar', 1))SELECT nameFROM sitesWHERE open_now = 1ORDER BY name 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.
Review the lesson
An observatory directory stores a name and an open flag for each site. WITH gives the inline sample rows a temporary name for this query. SELECT chooses the output column, WHERE filters individual rows, and ORDER BY makes the remaining names appear in a predictable alphabetical order.