Oracle 5.0 Reference Manual page 855

Table of Contents

Advertisement

Type
MEDIUMINT
INT
BIGINT
11.1.4.2. Fixed-Point Types (Exact Value) - DECIMAL,
The
DECIMAL
is important to preserve exact precision, for example with monetary data. In MySQL,
implemented as DECIMAL, so the following remarks about
As of MySQL 5.0.3,
strings, with one character used for each digit of the value, the decimal point (if the scale is greater
than 0), and the "-" sign (for negative numbers). See
In a
DECIMAL
example:
salary DECIMAL(5,2)
In this example,
digits that are stored for values, and the scale represents the number of digits that can be stored
following the decimal point.
Standard SQL requires that
decimals, so values that can be stored in the
enforces this limit as of MySQL 5.0.3. Before 5.0.3, on the positive end of the range, the column could
actually store numbers up to 9999.99. (For positive numbers, MySQL 5.0.2 and earlier used the byte
reserved for the sign to extend the upper end of the range.)
In standard SQL, the syntax
is equivalent to DECIMAL(M,0), where the implementation is permitted to decide the value
DECIMAL
of M. MySQL supports both of these variant forms of
If the scale is 0,
The maximum number of digits for
5.0.3, the maximum range of
given
DECIMAL
a column is assigned a value with more digits following the decimal point than are permitted by the
specified scale, the value is converted to that scale. (The precise behavior is operating system-specific,
but generally the effect is truncation to the permissible number of digits.)
11.1.4.3. Floating-Point Types (Approximate Value) - FLOAT,
The
and
FLOAT
single-precision values and eight bytes for double-precision values.
For FLOAT, the SQL standard permits an optional specification of the precision (but not the range of
the exponent) in bits following the keyword
precision specification, but the precision value is used only to determine storage size. A precision from
Storage
Minimum Value
(Bytes)
(Signed/Unsigned)
0
3
-8388608
0
4
-2147483648
0
8
-9223372036854775808
0
and
types store exact numeric data values. These types are used when it
NUMERIC
values are stored in binary format. Previously, they were stored as
DECIMAL
column declaration, the precision and scale can be (and usually is) specified; for
is the precision and
5
DECIMAL(5,2)
DECIMAL(M)
values contain no decimal point or fractional part.
DECIMAL
DECIMAL
DECIMAL
column can be constrained by the precision or scale for a given column. When such
types represent approximate numeric data values. MySQL uses four bytes for
DOUBLE
Numeric Types
NUMERIC
DECIMAL
Section 12.17, "Precision
is the scale. The precision represents the number of significant
2
be able to store any value with five digits and two
column range from
salary
is equivalent to DECIMAL(M,0). Similarly, the syntax
DECIMAL
is 65 (64 from MySQL 5.0.3 to 5.0.5). Before MySQL
values is the same as for DOUBLE, but the actual range for a
in parentheses. MySQL also supports this optional
FLOAT
835
Maximum Value
Signed/Unsigned)
65535
8388607
16777215
2147483647
4294967295
9223372036854775807
18446744073709551615
NUMERIC
apply equally to NUMERIC.
Math".
to 999.99. MySQL
-999.99
syntax. The default value of
DOUBLE
is
is 10.
M

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents