SQL FROM

Tells the database which table to read from — every query needs one.

What & Why

FROM names the table a query reads its rows from. It always follows SELECT in how you write a query, though the database actually reads FROM first when it runs — a detail covered in the Execution Order lesson.

See How It Works

idnamechannelspendstart_dateend_datestatustarget_segment
1Spring Launchgoogle_ads55000.002024-01-152024-03-31activesmb
2Retention Webinaremail45000.002024-02-102024-04-15activeenterprise
3Finance Retargetinglinkedin50000.002024-03-122024-05-31activeenterprise
4Enterprise Searchgoogle_ads60000.002024-04-012024-06-30activeenterprise
EXAMPLE QUERY
SELECT name
FROM marketing.campaigns;
RESULT
name
Spring Launch
Retention Webinar
Finance Retargeting
Enterprise Search

The result uses the same Queryflo columns shown in the worked example.

Now You Try

Practice this concept

Product needs the first ten feature names and their owning teams. Read the data from the real product feature table.

Available schema
product

Prefix tables with product.table_name.

nameteam
product.features
ColumnType
idinteger
nametext
descriptiontext
teamtext
released_attimestamp with time zone
deprecated_attimestamp with time zone
internal_priorityinteger
query.sql
Beginner business practice

Sign up free to try it on a real business scenario