Numeric Type Overview
827
+-------------------------------+
mysql>
SELECT IF(2 = FALSE, 'true', 'false');
+--------------------------------+
| IF(2 = FALSE, 'true', 'false') |
+--------------------------------+
| false |
+--------------------------------+
The last two statements display the results shown because
2
is equal to neither
1
nor
0
.
•
SMALLINT[(M)] [UNSIGNED] [ZEROFILL]
A small integer. The signed range is
-32768
to
32767
. The unsigned range is
0
to
65535
.
•
MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]
A medium-sized integer. The signed range is
-8388608
to
8388607
. The unsigned range is
0
to
16777215
.
•
INT[(M)] [UNSIGNED] [ZEROFILL]
A normal-size integer. The signed range is
-2147483648
to
2147483647
. The unsigned range is
0
to
4294967295
.
•
INTEGER[(M)] [UNSIGNED] [ZEROFILL]
This type is a synonym for
INT
.
•
BIGINT[(M)] [UNSIGNED] [ZEROFILL]
A large integer. The signed range is
-9223372036854775808
to
9223372036854775807
. The
unsigned range is
0
to
18446744073709551615
.
SERIAL
is an alias for
BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE
.
Some things you should be aware of with respect to
BIGINT
columns:
• All arithmetic is done using signed
BIGINT
or
DOUBLE
values, so you should not use unsigned
big integers larger than
9223372036854775807
(63 bits) except with bit functions! If you do that,
some of the last digits in the result may be wrong because of rounding errors when converting a
BIGINT
value to a
DOUBLE
.
MySQL can handle
BIGINT
in the following cases:
• When using integers to store large unsigned values in a
BIGINT
column.
• In
MIN(col_name)
[971]
or
MAX(col_name)
[971]
, where
col_name
refers to a
BIGINT
column.
• When using operators (
+
[906]
,
-
[906]
,
*
[906]
, and so on) where both operands are
integers.
• You can always store an exact integer value in a
BIGINT
column by storing it using a string. In
this case, MySQL performs a string-to-number conversion that involves no intermediate double-
precision representation.
• The
-
[906]
,
+
[906]
, and
*
[906]
operators use
BIGINT
arithmetic when both operands are
integer values. This means that if you multiply two big integers (or results from functions that return
integers), you may get unexpected results when the result is larger than
9223372036854775807
.
•
DECIMAL[(M[,D])] [UNSIGNED] [ZEROFILL]
For MySQL 5.0.3 and above:
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...