SQL Addition

The + operator adds two numeric values together — works on literals, columns, or any combination of both.

What & Why

Plain + adds two numbers. It works between two columns, a column and a literal, or two literals — the same operator in every case.

See How It Works

BUSINESS QUESTION

Marketing wants total engagement from opens and clicks for each email send.

idcampaign_idsent_atrecipientsopensclicksunsubscribesbounces
20112024-01-20 15:00:00+001200540180924
20222024-02-15 16:30:00+0080042096512
20332024-03-18 13:00:00+0015006102251431
20442024-04-08 14:00:00+0000000
EXAMPLE QUERY
SELECT
  id AS send_id,
  opens + clicks AS engagement_actions
FROM marketing.email_sends
ORDER BY send_id;
RESULT — exact output from the displayed Queryflo rows
send_idengagement_actions
201720
202516
203835
2040

Each value is the actual opens-plus-clicks sum for one email send.

Now You Try

Practice this concept

Marketing wants total engagement from opens and clicks for each email send.

Available schema
marketing

Prefix tables with marketing.table_name.

send_idengagement_actions
marketing.email_sends
ColumnType
idinteger
campaign_idinteger
sent_attimestamp with time zone
recipientsinteger
opensinteger
clicksinteger
unsubscribesinteger
bouncesinteger
legacy_send_grouptext
query.sql
Intermediate business practice

Sign up free to try it on a real business scenario