+-------------------------------+
mysql>
SELECT IF(2 = FALSE, 'true', 'false');
+--------------------------------+
| IF(2 = FALSE, 'true', 'false') |
+--------------------------------+
| false
+--------------------------------+
The last two statements display the results shown because
•
SMALLINT[(M)] [UNSIGNED] [ZEROFILL]
A small integer. The signed range is
•
MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]
A medium-sized integer. The signed range is
16777215.
•
INT[(M)] [UNSIGNED] [ZEROFILL]
A normal-size integer. The signed range is
to 4294967295.
•
INTEGER[(M)] [UNSIGNED] [ZEROFILL]
This type is a synonym for INT.
•
BIGINT[(M)] [UNSIGNED] [ZEROFILL]
A large integer. The signed range is
unsigned range is
to 18446744073709551615.
0
is an alias for
SERIAL
Some things you should be aware of with respect to
• All arithmetic is done using signed
big integers larger than
some of the last digits in the result may be wrong because of rounding errors when converting a
value to a DOUBLE.
BIGINT
MySQL can handle
• When using integers to store large unsigned values in a
• In
MIN(col_name)
column.
• When using operators
integers.
• You can always store an exact integer value in a
this case, MySQL performs a string-to-number conversion that involves no intermediate double-
precision representation.
• The
[906],
[906], and
-
+
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:
Numeric Type Overview
|
-32768
-2147483648
-9223372036854775808
BIGINT UNSIGNED NOT NULL AUTO_INCREMENT
BIGINT
9223372036854775807
in the following cases:
BIGINT
[971]
or
MAX(col_name)
(+
[906],
[906],
-
*
[906]
operators use
*
827
is equal to neither
2
to 32767. The unsigned range is
to 8388607. The unsigned range is
-8388608
to 2147483647. The unsigned range is
to 9223372036854775807. The
columns:
BIGINT
or
values, so you should not use unsigned
DOUBLE
(63 bits) except with bit functions! If you do that,
BIGINT
[971], where
col_name
[906], and so on) where both operands are
column by storing it using a string. In
BIGINT
arithmetic when both operands are
BIGINT
nor 0.
1
to 65535.
0
UNIQUE.
column.
refers to a
BIGINT
to
0
0