Numeric Types
834
•
ENUM('value1','value2',...) [CHARACTER SET charset_name] [COLLATE
collation_name]
An enumeration. A string object that can have only one value, chosen from the list of values
'value1'
,
'value2'
,
...
,
NULL
or the special
''
error value.
ENUM
values are represented
internally as integers.
An
ENUM
column can have a maximum of 65,535 distinct elements. (The practical limit is less than
3000.) A table can have no more than 255 unique element list definitions among its
ENUM
and
SET
columns considered as a group. For more information on these limits, see
Section E.7.5, “Limits
Imposed by
.frm
File Structure”
.
•
SET('value1','value2',...) [CHARACTER SET charset_name] [COLLATE
collation_name]
A set. A string object that can have zero or more values, each of which must be chosen from the list
of values
'value1'
,
'value2'
,
...
SET
values are represented internally as integers.
A
SET
column can have a maximum of 64 distinct members. A table can have no more than 255
unique element list definitions among its
ENUM
and
SET
columns considered as a group. For more
information on this limit, see
Section E.7.5, “Limits Imposed by
.frm
File Structure”
.
11.1.4. Numeric Types
MySQL supports all standard SQL numeric data types. These types include the exact numeric data
types (
INTEGER
,
SMALLINT
,
DECIMAL
, and
NUMERIC
), as well as the approximate numeric data
types (
FLOAT
,
REAL
, and
DOUBLE PRECISION
). The keyword
INT
is a synonym for
INTEGER
, and
the keywords
DEC
and
FIXED
are synonyms for
DECIMAL
. MySQL treats
DOUBLE
as a synonym for
DOUBLE PRECISION
(a nonstandard extension). MySQL also treats
REAL
as a synonym for
DOUBLE
PRECISION
(a nonstandard variation), unless the
REAL_AS_FLOAT
[539]
SQL mode is enabled.
As of MySQL 5.0.3, a
BIT
data type is available for storing bit-field values. (Before 5.0.3, MySQL
interprets
BIT
as
TINYINT(1)
.) In MySQL 5.0.3,
BIT
is supported only for
MyISAM
. MySQL 5.0.5
extends
BIT
support to
MEMORY
,
InnoDB
,
BDB
, and
NDBCLUSTER
.
For information about how MySQL handles assignment of out-of-range values to columns and overflow
during expression evaluation, see
Section 11.1.4.6, “Out-of-Range and Overflow Handling”
.
For information about numeric type storage requirements, see
Section 11.2, “Data Type Storage
Requirements”
.
The data type used for the result of a calculation on numeric operands depends on the types of the
operands and the operations performed on them. For more information, see
Section 12.6.1, “Arithmetic
Operators”
.
11.1.4.1. Integer Types (Exact Value) -
INTEGER
,
INT
,
SMALLINT
,
TINYINT
,
MEDIUMINT
,
BIGINT
MySQL supports the SQL standard integer types
INTEGER
(or
INT
) and
SMALLINT
. As an extension
to the standard, MySQL also supports the integer types
TINYINT
,
MEDIUMINT
, and
BIGINT
. The
following table shows the required storage and range for each integer type.
Type
Storage
Minimum Value
Maximum Value
(Bytes)
(Signed/Unsigned)
Signed/Unsigned)
TINYINT
1
-128
127
0
255
SMALLINT
2
-32768
32767
Содержание 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 ...