Oracle 5.0 Reference Manual page 874

Table of Contents

Advertisement

columns considered as a group. For more information on these limits, see
Imposed by
Trailing spaces are automatically deleted from
is created.
When retrieved, values stored into an
in the column definition. Note that
binary or case-sensitive collations, lettercase is taken into account when assigning values to the
column.
If you retrieve an
you can retrieve numeric values from an
mysql>
SELECT enum_col+0 FROM tbl_name;
If you store a number into an
and the value stored is the enumeration member with that index. (However, this does not work with
DATA, which treats all input as strings.) If the numeric value is quoted, it is still interpreted as
LOAD
an index if there is no matching string in the list of enumeration values. For these reasons, it is not
advisable to define an
easily become confusing. For example, the following column has enumeration members with string
values of '0', '1', and '2', but numeric index values of 1, 2, and 3:
numbers ENUM('0','1','2')
If you store 2, it is interpreted as an index value, and becomes
'2', it matches an enumeration value, so it is stored as '2'. If you store '3', it does not match any
enumeration value, so it is treated as an index and becomes
mysql>
INSERT INTO t (numbers) VALUES(2),('2'),('3');
mysql>
SELECT * FROM t;
+---------+
| numbers |
+---------+
| 1
|
| 2
|
| 2
|
+---------+
values are sorted according to the order in which the enumeration members were listed in the
ENUM
column specification. (In other words,
example,
'a'
'a'). The empty string sorts before nonempty strings, and
enumeration values. To prevent unexpected results, specify the
can also use
column is sorted lexically rather than by index number.
Functions such as
to a number if necessary. For
To determine all possible values for an
'enum_col'
In the C API,
distinguish them from other strings, see
11.1.6.5. The
SET
A
is a string object that can have zero or more values, each of which must be chosen from a list
SET
of permitted values specified when the table is created.
members are specified with members separated by commas (","). A consequence of this is that
member values should not themselves contain commas.
File
Structure".
.frm
value in a numeric context, the column value's index is returned. For example,
ENUM
ENUM
column with enumeration values that look like numbers, because this can
ENUM
sorts before
for
'b'
ORDER BY CAST(col AS CHAR)
[972]
or
SUM()
ENUM
and parse the
ENUM
values are returned as strings. For information about using result set metadata to
ENUM
Type
String Types
member values in the table definition when a table
ENUM
column are displayed using the lettercase that was used
ENUM
columns can be assigned a character set and collation. For
ENUM
column like this:
ENUM
column, the number is treated as the index into the possible values,
values are sorted according to their index numbers.) For
ENUM
'b'), but
ENUM('a',
or
ORDER BY CONCAT(col)
[969]
that expect a numeric argument cast the argument
AVG()
values, the cast operation causes the index number to be used.
column, use
ENUM
definition in the
Type
Section 20.6.4, "C API Data
SET
854
Section E.7.5, "Limits
(the value with index 2). If you store
'1'
(the value with index 3).
'2'
sorts before
'b'
'a'
values sort before all other
NULL
list in alphabetic order. You
ENUM
SHOW COLUMNS FROM tbl_name LIKE
column of the output.
Structures".
column values that consist of multiple set
for
ENUM('b',
to make sure that the
SET

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents