Camp 1 · Step 3 of 13
Your first SELECT
SELECT and FROM — ask a live database real questions and read its answers.
SELECT is the beating heart of SQL — by some estimates over 90% of all
queries ever run. Time to write yours.
Choosing columns
The shape: SELECT which columns, FROM which table. Order the
columns however you like — try lessons, name.
The * you met last lesson means "all columns":
Computing as you select
The SELECT list can contain expressions, not just column names:
AS minutes names the computed column — an alias. The database did
math on every row in one line. (This is that declarative magic: no loop
in sight.)
Case and formatting
SQL keywords are case-insensitive — select, SELECT, SeLeCt all work.
Convention: KEYWORDS IN CAPS, table and column names in lowercase. It
makes the query's skeleton visible at a glance.
Which query shows only the difficulty of every trail?
What does AS do in: SELECT lessons * 12 AS minutes …?