SQL Multiplication

The * operator multiplies two numeric values — commonly used for percentage-based raises, tax calculations, or unit-price times quantity.

What & Why

Plain * multiplies two numbers. A common pattern: multiplying a base value by a decimal factor to compute a percentage-based adjustment, like a raise or discount.

See How It Works

BUSINESS QUESTION

Marketing wants campaign spend shown in cents for an export.

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
  id AS campaign_id,
  spend,
  ROUND(spend * 100)::bigint AS spend_cents
FROM marketing.campaigns
ORDER BY campaign_id;
RESULT — exact output from the displayed Queryflo rows
campaign_idspendspend_cents
155000.005500000
245000.004500000
350000.005000000
460000.006000000

Multiplying the real decimal spend values by 100 returns whole cents.

Now You Try

Practice this concept

Marketing wants campaign spend shown in cents for an export.

Available schema
marketing

Prefix tables with marketing.table_name.

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

Sign up free to try it on a real business scenario