Skip to content
KodeTrail

Camp 1 · Step 3 of 13

Your first SELECT

SELECT and FROM — ask a live database real questions and read its answers.

12 min+50 XP

SELECT is the beating heart of SQL — by some estimates over 90% of all queries ever run. Time to write yours.

Choosing columns

SQL

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":

SQL

Computing as you select

The SELECT list can contain expressions, not just column names:

SQL

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.

Checkpoint

Which query shows only the difficulty of every trail?

Checkpoint

What does AS do in: SELECT lessons * 12 AS minutes …?