note that IGNORE is accepted but
ignored in ALTER TABLE ... EXCHANGE PARTITION statements.

This statement can also be used to rename a table. For details see RENAME
TABLE.

When an index is created, the storage engine may use a configurable buffer in
the process. Incrementing the buffer speeds up the index creation. Aria and
MyISAM allocate a buffer whose size is defined by aria_sort_buffer_size or
myisam_sort_buffer_size, also used for REPAIR TABLE. InnoDB allocates three
buffers whose size is defined by innodb_sort_buffer_size.

Privileges
----------

Executing the ALTER TABLE statement generally requires at least the ALTER
privilege for the table or the database..

If you are renaming a table, then it also requires the DROP, CREATE and INSERT
privileges for the table or the database as well.

Online DDL
----------

Online DDL is supported with the ALGORITHM and LOCK clauses.

See InnoDB Online DDL Overview for more information on online DDL with InnoDB.

ALTER ONLINE TABLE
------------------

ALTER ONLINE TABLE also works for partitioned tables.

Online ALTER TABLE is available by executing the following:

ALTER ONLINE TABLE ...;

This statement has the following semantics:

This statement is equivalent to the following:

ALTER TABLE ... LOCK=NONE;

See the LOCK alter specification for more information.

WAIT/NOWAIT
-----------

Set the lock wait timeout. See WAIT and NOWAIT.

IF EXISTS
---------

The IF EXISTS and IF NOT EXISTS clauses are available for the following:

ADD COLUMN       [IF NOT EXISTS]
ADD INDEX        [IF NOT EXISTS]
ADD FOREIGN KEY  [IF NOT EXISTS]
ADD PARTITION    [IF NOT EXISTS]
CREATE INDEX     [IF NOT EXISTS]
DROP COLUMN      [IF EXISTS]
DROP INDEX       [IF EXISTS]
DROP FOREIGN KEY [IF EXISTS]
DROP PARTITION   [IF EXISTS]
CHANGE COLUMN    [IF EXISTS]
MODIFY COLUMN    [IF EXISTS]
DROP INDEX       [IF EXISTS]
When IF EXISTS and IF NOT EXISTS are used in clauses, queries will not report
errors when the condition is triggered for that clause. A warning with the
same message text will be issued and the ALTER will move on to the next clause
in the statement (or end if finished).

MariaDB starting with 10.5.2
----------------------------
If this is directive is used after ALTER ... TABLE, one will not get an error
if the table doesn't exist.

Column Definitions
------------------

See CREATE TABLE: Column Definitions for information about column definitions.

Index Definitions
-----------------

See CREATE TABLE: Index Definitions for information about index definitions.

The CREATE INDEX and DROP INDEX statements can also be used to add or remove
an index.

Character Sets and Collations
-----------------------------

CONVERT TO CHARACTER SET charset_name [COLLATE collation_name]
[DEFAULT] CHARACTER SET [=] charset_name
[DEFAULT] COLLATE [=] collation_name
See Setting Character Sets and Collations for details on setting the character
sets and collations.

Alter Specifications
--------------------

Table Options
-------------

See CREATE TABLE: Table Options for information about table options.

ADD COLUMN
----------

... ADD COLUMN [IF NOT EXISTS]  (col_name column_definition,...)
Adds a column to the table. The syntax is the same as in CREATE TABLE. If you
are using IF NOT_EXISTS the column will not be added if it was not there
already. This is very useful when doing scripts to modify tables.

The FIRST and AFTER clauses affect the physical order of columns in the
datafile. Use FIRST to add a column in the first (leftmost) position, or AFTER
followed by a column name to add the new column in any other position. Note
that, nowadays, the physical position of a column is usually irrelevant.

See also Instant ADD COLUMN for InnoDB.

DROP COLUMN
-----------

... DROP COLUMN [IF EXISTS] col_name [CASCADE|RESTRICT]
Drops the column from the table. If you are using IF EXISTS you will not get
an error if the column didn't exist. If the column is part of any index, the
column will be dropped from them, except if you add a new column with
identical name at the same time. The index will be dropped if all coY