Learn SQL/Beginner/SQL Foundations/SQL SELECT Multiple Columns

SQL SELECT Multiple Columns

List more than one column, separated by commas, in whatever order you want them returned.

What & Why

Separate column names with commas to return more than one — and the output columns appear in exactly the order you list them, regardless of their order in the actual table.

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, channel, spend
FROM marketing.campaigns;
RESULT
namechannelspend
Spring Launchgoogle_ads55000.00
Retention Webinaremail45000.00
Finance Retargetinglinkedin50000.00
Enterprise Searchgoogle_ads60000.00

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

Now You Try

Practice this concept

Marketing wants a compact campaign export with campaign name, channel, spend, and status.

Available schema
marketing

Prefix tables with marketing.table_name.

namechannelspendstatus
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