This page is part of the book SQL-99 Complete, Really, by Peter Gulutzan & Trudy Pelzer. The authors have graciously allowed us to reproduce the contents of the book here. Because the book is about the SQL-99 standard, the contents of this and other pages in the book may not directly apply to MariaDB. Use the navigation bar to navigate the book.

In SQL, a number i.e.: any signed, or unsigned, combination of the digits 0 to 9 is either an exact numeric value or an approximate numeric value. A numeric value may be a <literal>, the value of a parameter or a host language variable or the result of any expression or argument (including a possibly qualified <Column name>) that evaluates to a number.

Exact numeric values have a precision and a scale. The precision is a positive integer that determines the number of significant digits in the radix. The scale is a non-negative integer that specifies the number of digits to the right of the value's decimal point. Exact numeric values are stored in one of the four exact numeric <data type>s: INTEGER, SMALLINT, NUMERIC or DECIMAL.

Approximate numeric values, or floating point numbers, have two parts: a signed decimal number (the mantissa) and a signed integer (the exponent). The exponent specifies the magnitude of the mantissa, so the value of such a number is the mantissa raised to the power of the exponent. Approximate numeric values also have a precision: a positive integer that specifies the number of significant bits in the mantissa. Approximate numeric values are stored in one of the three approximate numeric <data type>s: FLOAT, REAL or DOUBLE PRECISION.