Oracle 5.0 Reference Manual page 875

Table of Contents

Advertisement

For example, a column specified as
''
'one'
'two'
'one,two'
A
column can have a maximum of 64 distinct members. A table can have no more than 255
SET
unique element list definitions among its
information on this limit, see
Duplicate values in the definition cause a warning, or an error if strict SQL mode is enabled.
Trailing spaces are automatically deleted from
is created.
When retrieved, values stored in a
column definition. Note that
case-sensitive collations, lettercase is taken into account when assigning values to the column.
MySQL stores
values numerically, with the low-order bit of the stored value corresponding to
SET
the first set member. If you retrieve a
corresponding to the set members that make up the column value. For example, you can retrieve
numeric values from a
mysql>
SELECT set_col+0 FROM tbl_name;
If a number is stored into a
determine the set members in the column value. For a column specified as SET('a','b','c','d'),
the members have the following decimal and binary values.
Member
SET
'a'
'b'
'c'
'd'
If you assign a value of
members
and
'a'
'd'
For a value containing more than one
listed in when you insert the value. It also does not matter how many times a given element is listed in
the value. When the value is retrieved later, each element in the value appears once, with elements
listed according to the order in which they were specified at table creation time. For example, suppose
that a column is specified as SET('a','b','c','d'):
mysql>
CREATE TABLE myset (col SET('a', 'b', 'c', 'd'));
If you insert the values 'a,d', 'd,a', 'a,d,d', 'a,d,a', and 'd,a,d':
mysql>
INSERT INTO myset (col) VALUES
-> ('a,d'), ('d,a'), ('a,d,a'), ('a,d,d'), ('d,a,d');
Query OK, 5 rows affected (0.01 sec)
Records: 5
Duplicates: 0
Then all these values appear as
mysql>
SELECT col FROM myset;
+------+
| col
|
+------+
| a,d
|
String Types
SET('one', 'two') NOT NULL
ENUM
Section E.7.5, "Limits Imposed by
column are displayed using the lettercase that was used in the
SET
columns can be assigned a character set and collation. For binary or
SET
value in a numeric context, the value retrieved has bits set
SET
column like this:
SET
column, the bits that are set in the binary representation of the number
SET
Decimal Value
1
2
4
8
to this column, that is
9
are selected and the resulting value is 'a,d'.
element, it does not matter what order the elements are
SET
Warnings: 0
when retrieved:
'a,d'
855
and
columns considered as a group. For more
SET
File
.frm
member values in the table definition when a table
SET
Binary Value
0001
0010
0100
1000
in binary, so the first and fourth
1001
can have any of these values:
Structure".
value
SET

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents