Oracle 5.0 Reference Manual page 1034

Table of Contents

Advertisement

| DISCARD TABLESPACE
| IMPORT TABLESPACE
index_col_name:
col_name
index_type:
USING {BTREE | HASH}
table_options:
table_option
ALTER TABLE
or destroy indexes, change the type of existing columns, or rename columns or the table itself. You can
also change characteristics such as the storage engine used for the table or the table comment.
Following the table name, specify the alterations to be made. If none are given,
nothing.
The syntax for many of the permissible alterations is similar to clauses of the
statement. See
Some operations may result in warnings if attempted on a table for which the storage engine does not
support the operation. These warnings can be displayed with
"SHOW WARNINGS
If you use
ALTER TABLE
your column was not changed, it is possible that MySQL ignored your modification for one of the
reasons described in
For information on troubleshooting
TABLE".
Storage, Performance, and Concurrency Considerations
In most cases,
operations that are modifying the table, then proceeds. It incorporates the alteration into the copy,
deletes the original table, and renames the new one. While
table is readable by other sessions. Updates and writes to the table that begin after the
operation begins are stalled until the new table is ready, then are automatically redirected to the new
table without any failed updates. The temporary table is created in the database directory of the new
table. This can differ from the database directory of the original table for
rename the table to a different database.
If you use
ALTER TABLE tbl_name RENAME TO new_tbl_name
simply renames any files that correspond to the table
use the
RENAME TABLE
Any privileges granted specifically for the renamed table are not migrated to the new name. They must
be changed manually.
If you use any option to
even if the data wouldn't strictly need to be copied (such as when you change the name of a column).
For
MyISAM
setting the
myisam_sort_buffer_size
• To use
ALTER
the table. Renaming a table requires
[576], and
CREATE
is a MySQL extension to standard SQL. It controls how
IGNORE
duplicates on unique keys in the new table or if warnings occur when strict mode is enabled. If
is not specified, the copy is aborted and rolled back if duplicate-key errors occur. If
IGNORE
ALTER TABLE
[(length)] [ASC | DESC]
[[,] table_option] ...
changes the structure of a table. For example, you can add or delete columns, create
Section 13.1.10,
"CREATE TABLE
Syntax".
to change a column specification but
Section 13.1.10.3, "Silent Column Specification
ALTER
makes a temporary copy of the original table. MySQL waits for other
ALTER TABLE
statement to rename tables. See
ALTER TABLE
tables, you can speed up index re-creation (the slowest part of the alteration process) by
TABLE, you need
[577]
INSERT
Syntax
(see
CREATE TABLE
Syntax", for more information.
TABLE, see
Section C.5.7.1, "Problems with
tbl_name
Section 13.1.20,
other than RENAME, MySQL always creates a temporary table,
[476]
system variable to a high value.
[576],
ALTER
CREATE
[576]
and
ALTER
DROP
on the new table.
1014
options)
ALTER TABLE
CREATE TABLE
WARNINGS. See
SHOW
DESCRIBE tbl_name
Changes".
is executing, the original
ALTER TABLE
ALTER TABLE
without any other options, MySQL
without making a copy. (You can also
"RENAME TABLE
[576], and
[577]
INSERT
[577]
on the old table,
ALTER TABLE
does
Section 13.7.5.37,
indicates that
ALTER
ALTER TABLE
operations that
Syntax".)
privileges for
[576],
ALTER
works if there are
IGNORE

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents