SET column type : Set : Data Types MySQL TUTORIALS


MySQL TUTORIALS » Data Types » Set »

 

SET column type


mysql>
mysql> CREATE TABLE myTable
    -> (
    ->    ID SMALLINT UNSIGNED,
    ->    Model VARCHAR(40),
    ->    Color ENUM('red', 'blue', 'green', 'yellow'),
    ->    Options SET('rack', 'light', 'helmet', 'lock')
    -> );
Query OK, rows affected (0.03 sec)

mysql>
mysql> desc myTable;
+---------+-------------------------------------+------+-----+---------+-------+
| Field   | Type                                | Null | Key | Default | Extra |
+---------+-------------------------------------+------+-----+---------+-------+
| ID      | smallint(5unsigned                | YES  |     | NULL    |       |
| Model   | varchar(40)                         | YES  |     | NULL    |       |
| Color   | enum('red','blue','green','yellow') | YES  |     | NULL    |       |
| Options | set('rack','light','helmet','lock') | YES  |     | NULL    |       |
+---------+-------------------------------------+------+-----+---------+-------+
rows in set (0.00 sec)

mysql>
mysql> drop table myTable;
Query OK, rows affected (0.02 sec)



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Data Types
» Set