Arithmetic multiplication operator *

Last updated: 2026-11-04

Arithmetic multiplication operator *

The multiplication operator * multiplies two numeric operands and is the usual way to compute amount times quantity. It applies to integer, numeric, double precision and other numeric types, and numeric multiplication keeps the scale of the result. A NULL operand yields a NULL result.

Kindoperator
Example LanguageSQL

📝 Syntax

a * b

Precedence: `*` sits at the same level as `/` and `%`, above binary `+ -` and below `^`; operators at the same level are left-associative, so `2 * 3 + 4 * 5` evaluates the multiplications first and gives 26. Division and modulo share that level and are also left-associative (`10 / 4 * 2` is 4, not 5).

⚙️ Parameters

aLeft operand, numeric; if NULL the result is NULL.
bRight operand, numeric; if NULL the result is NULL.

Returns:A numeric value; NULL if either operand is NULL.

▶ Example

Runs real PostgreSQL 18 right in your browser (PGlite WASM, nothing to install). Press ▶ Run and the result appears in the panel below.

Output:

SELECT id, price, qty, price * qty AS amount FROM t_mul ORDER BY id
id | price |  qty | amount
---+-------+------+-------
 1 | 19.90 |    3 |  59.70
 2 | 19.90 | NULL |   NULL
(2 rows)

SELECT price * qty IS NULL AS null_is_absent FROM t_mul WHERE id = 2
null_is_absent
--------------
true          
(1 row)

📌 Key Points

More case studies coming soon.

📚 Related Reference

❓ FAQ

QDo floating point multiplications lose precision?
AYes. real and double precision are binary floats, so 0.1*3 can yield 0.30000000000000004. Use numeric, or store money as integer cents, for financial calculations.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

Content reviewed by MOTO · Found an error? Report it

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏