For the complete documentation index, see llms.txt. This page is also available as Markdown.

Multiplication Operator (*)

Multiply two numbers. If integer multiplication overflows the BIGINT range, an error is returned.

Syntax

*

Description

Multiplication operator.

If both operands are integers and the product is outside the BIGINT range, the multiplication fails with an error. To get the exact product, make one of the operands a DECIMAL, for example by adding .0 to it.

Examples

SELECT 7*6;
+-----+
| 7*6 |
+-----+
|  42 |
+-----+

SELECT 1234567890*9876543210;
ERROR 1690 (22003): BIGINT value is out of range in '1234567890 * 9876543210'

SELECT 1234567890*9876543210.0;
+-------------------------+
| 1234567890*9876543210.0 |
+-------------------------+
|  12193263111263526900.0 |
+-------------------------+

SELECT 18014398509481984*18014398509481984.0;
+---------------------------------------+
| 18014398509481984*18014398509481984.0 |
+---------------------------------------+
|   324518553658426726783156020576256.0 |
+---------------------------------------+

SELECT 18014398509481984*18014398509481984;
ERROR 1690 (22003): BIGINT value is out of range in '18014398509481984 * 18014398509481984'

See Also

This page is licensed: GPLv2, originally from fill_help_tables.sql

spinner

Last updated

Was this helpful?