|
|
|
|
| |
We have already covered the basic syntax for the CREATE TABLE statement and discussed how to write column definitions. I assume you've read those chapters and won't repeat that material here. Instead, the remainder of this section deals with some important extensions to the CREATE TABLE statement that were introduced beginning with MySQL 3.23 and that give you a lot of flexibility in how you construct tables:
Table options that modify storage characteristics
Creation of a table only if it doesn't already exist
Temporary tables that are dropped automatically when the client session ends
The capability of creating a table from the result of a SELECT query
Using MERGE tables
Table Options
As of MySQL 3.23, you can add table options after the closing parenthesis in the CREATE TABLE statement to modify the table's storage characteristics. For example, prior to MySQL 3.23, any table created will be of type ISAM, because that is the only type available. From 3.23 on, you can add a TYPE = tbl_type option to specify the type explicitly. For example, to create a HEAP or InnoDB table, write the statement like this (the table type name is not case sensitive):
CREATE TABLE mytbl ( ... ) TYPE = HEAP;
CREATE TABLE mytbl ( ... ) TYPE = INNODB;
With no TYPE specifier, the server creates the table using its default type. This will be MyISAM unless you reconfigure the server to use a different default, either when you build the server or by giving a --default-table-type option at server startup time. If you specify a table type name that is syntactically legal but for which the handler is unavailable, MySQL creates the table using the default type. If you give an illegal table type, an error results.
|
|
|
|
|
|
| Link Partners: Asia florist, Flowers to India, Hong kong flowers, Site submit, Cheap web hosting, China florist, Japan florist |
|