
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Set options while creating a MySQL table. Display the same options as well
To display, use DESC command or information_schema.columns. Let us first create a table and set options −
mysql> create table DemoTable ( Color SET('RED','GREEN','BLUE','YELLOW') ); Query OK, 0 rows affected (0.47 sec)
Case 1
Here is the query to get the list of available options for SET using the DESC command −
mysql> desc DemoTable;
This will produce the following output −
+-------+------------------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+------------------------------------+------+-----+---------+-------+ | Color | set('RED','GREEN','BLUE','YELLOW') | YES | | NULL | | +-------+------------------------------------+------+-----+---------+-------+ 1 row in set (0.00 sec)
Case 2
Here is the query for a list of available options for SET using the information_schema.columns concept −
mysql> select column_type from information_schema.columns where table_name = 'DemoTable' and column_name = 'Color';
This will produce the following output −
+------------------------------------+ | COLUMN_TYPE | +------------------------------------+ | set('RED','GREEN','BLUE','YELLOW') | +------------------------------------+ 1 row in set (0.01 sec)
- Related Articles
- Set AUTO_INCREMENT in a table while creating it in MySQL?
- Set DEFAULT values for columns while creating a table in MySQL
- Using Options to Set MySQL Program Variables
- MySQL Client Options
- Creating a Table in MySQL to set current date as default
- What are some frequently used mysqlimport options while uploading the data into MySQL table through command line?
- Can we use {} while creating a MySQL table?
- Create a new table in MySQL with specific options with DEFAULT?
- While creating a MySQL table use the reserved keyword ‘Key’
- Error occurs when table name “references” is set while creating a table
- Authentication options in SAP HANA while adding new system
- Set special characters for password while creating a new MySQL user?
- How can I store the fixed length string as well as variable length string in the same MySQL table?
- Command Options for Connecting to the MySQL Server
- Connecting to the MySQL Server Using Command Options

Advertisements