SQL SELECT

The command you'll type more than any other — it decides which columns come back, and nothing else.

What & Why

SELECT is how you choose which columns of a table you want returned. It doesn't filter rows (that's WHERE) and it doesn't limit how many come back (that's LIMIT) — it only decides which columns show up in the result.

See How It Works

BUSINESS QUESTION

Marketing wants a report that only shows campaign names and spend values — nothing else in the table.

Watch SELECT narrow the columnsStep 1 of 3
SELECT * FROM marketing.campaigns
idnamechannelspendstart_datestatus
1Spring Launchgoogle_ads550002024-01-15active
2Retention Webinaremail450002024-02-10active
3Finance Retargetinglinkedin500002024-03-12active

SELECT * keeps every column.

Syntax Pattern

See explanation
SELECT column_1, column_2
FROM schema.table_name;

-- Explore every column
SELECT *
FROM schema.table_name
LIMIT 10;
Now You Try

Practice this concept

Marketing wants a report that contains only each campaign name and spend value.

Available schema
marketing

Prefix tables with marketing.table_name.

namespend
marketing.campaigns
ColumnType
idinteger
nametext
channeltext
spendnumeric
start_datedate
end_datedate
statustext
target_segmenttext
legacy_idtext
query.sql
Beginner business practice

Sign up free to try it on a real business scenario