Oracle 5.0 Reference Manual page 1035

Table of Contents

Advertisement

is specified, only the first row is used of rows with duplicates on a unique key. The other conflicting
rows are deleted. Incorrect values are truncated to the closest matching acceptable value.
• Pending
INSERT DELAYED
to modify the table structure.
signifies a table option of the kind that can be used in the
table_option
statement, such as ENGINE, AUTO_INCREMENT, or AVG_ROW_LENGTH.
Syntax", lists all table options.) However,
TABLE
INDEX DIRECTORY
For example, to convert a table to be an
ALTER TABLE t1 ENGINE = InnoDB;
When you specify an
already has the specified storage engine.
The outcome of attempting to change a table's storage engine is affected by whether the desired
storage engine is available and the setting of the
described in
Section 5.1.7, "Server SQL
As of MySQL 5.0.23, to prevent inadvertent loss of data,
the storage engine of a table to
To change the value of the
ALTER TABLE t2 AUTO_INCREMENT = value;
You cannot reset the counter to a value less than or equal to any that have already been used. For
MyISAM, if the value is less than or equal to the maximum value currently in the
column, the value is reset to the current maximum plus one. For InnoDB, you can use
TABLE ... AUTO_INCREMENT = value
current maximum value in the column, no error occurs and the current sequence value is not
changed.
• You can issue multiple ADD, ALTER, DROP, and
statement, separated by commas. This is a MySQL extension to standard SQL, which permits only
one of each clause per
statement, do this:
ALTER TABLE t2 DROP COLUMN c, DROP COLUMN d;
CHANGE
col_name,
• The word
is optional and can be omitted.
COLUMN
column_definition
See
Section 13.1.10,
• You can rename a column using a
column_definition
that the column currently has. For example, to rename an
this:
ALTER TABLE t1 CHANGE a b INTEGER;
To change a column's type but not the name,
name, even if they are the same. For example:
ALTER TABLE t1 CHANGE b b BIGINT NOT NULL;
You can also use
MODIFY
ALTER TABLE
statements are lost if a table is write locked and
table options.
InnoDB
clause,
ENGINE
ALTER TABLE
Modes".
or BLACKHOLE.
MERGE
AUTO_INCREMENT
statement. For example, to drop multiple columns in a single
ALTER TABLE
col_name, and
DROP
clauses use the same syntax for
"CREATE TABLE
Syntax".
CHANGE old_col_name new_col_name
clause. To do so, specify the old and new column names and the definition
to change a column's type without renaming it:
1015
Syntax
ignores the
ALTER TABLE
table, use this statement:
rebuilds the table. This is true even if the table
NO_ENGINE_SUBSTITUTION
ALTER TABLE
counter to be used for new rows, do this:
as of MySQL 5.0.3, but if the value is less than the
clauses in a single
CHANGE
are MySQL extensions to standard SQL.
DROP INDEX
and
ADD
CHANGE
INTEGER
syntax still requires an old and new column
CHANGE
ALTER TABLE
CREATE TABLE
(Section 13.1.10,
"CREATE
DATA DIRECTORY
[537]
SQL mode, as
cannot be used to change
AUTO_INCREMENT
ALTER
ALTER TABLE
as for
CREATE
TABLE.
column from
to b, you can do
a
is used
and

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents