Site icon TestingDocs.com

MySQL Table Options

Overview

In this tutorial, we will learn about MySQL table options. Options can be added to the CREATE TABLE statement in order to control the manner in which the table is handled.

Table Options

The table options are as follows:

ENGINE

The ENGINE option is used to specify the storage engine. This option indicates the storage engine to be used for the database table.

ENGINE =<storage_engine_name>

COMMENT

Table description comment. The table comment can be up to 60 characters of free text.

COMMENT  ‘<table_comment>’

DEFAULT CHARSET

This option specifies the default character set for the table.

DEFAULT CHARSET <character set>

Example

CREATE TABLE ‘CountryLanguage’ (
‘CountryCode’ char (3) NOT NULL default ‘’,
‘Language’ char (30) NOT NULL default ‘’,
‘IsOfficial’ enum (‘T’, ‘F’) NOT NULL default ‘F’,
‘Percentage’ float (4,1) NOT NULL default ‘0.0’,
PRIMARY KEY (‘CountryCode’, ‘Language’)
) ENGINE=ISAM COMMENT ‘Languages Table’

Exit mobile version