
ALTER TABLE t1 RENAME INDEX i_old TO i_new;

RENAME COLUMN
-------------

MariaDB starting with 10.5.2
----------------------------
From MariaDB 10.5.2, it is possible to rename a column using the RENAME COLUMN
syntax, for example:

ALTER TABLE t1 RENAME COLUMN c_old TO c_new;

ADD PRIMARY KEY
---------------

Add a primary key.

For PRIMARY KEY indexes, you can specify a name for the index, but it is
silently ignored, and the name of the index is always PRIMARY.

See Getting Started with Indexes: Primary Key for more information.

DROP PRIMARY KEY
----------------

Drop a primary key.

For PRIMARY KEY indexes, you can specify a name for the index, but it is
silently ignored, and the name of the index is always PRIMARY.

See Getting Started with Indexes: Primary Key for more information.

ADD FOREIGN KEY
---------------

Add a foreign key.

For FOREIGN KEY indexes, a reference definition must be provided.

For FOREIGN KEY indexes, you can specify a name for the constraint, using the
CONSTRAINT keyword. That name will be used in error messages.

First, you have to specify the name of the target (parent) table and a column
or a column list which must be indexed and whose values must match to the
foreign key's values. The MATCH clause is accepted to improve the
compatibility with other DBMS's, but has no meaning in MariaDB. The ON DELETE
and ON UPDATE clauses specify what must be done when a DELETE (or a REPLACE)
statements attempts to delete a referenced row from the parent table, and when
an UPDATE statement attempts to modify the referenced foreign key columns in a
parent table row, respectively. The following options are allowed:

* RESTRICT: The delete/update operation is not performed.  The statement
terminates with a 1451 error (SQLSTATE '2300').
* NO ACTION: Synonym for RESTRICT.
* CASCADE: The delete/update operation is performed in both tables.
* SET NULL: The update or delete goes ahead in the parent table, and the
corresponding foreign key fields in the child table are set to NULL.  (They
must not be defined as NOT NULL for this to succeed).
* SET DEFAULT: This option is implemented only for the legacy PBXT storage
engine, which is disabled by default and no longer maintained. It sets the
child table's foreign key fields to their DEFAULT values when the referenced
parent table key entries are updated or deleted.

If either clause is omitted, the default behavior for the omitted clause is
RESTRICT.

See Foreign Keys for more information.

DROP FOREIGN KEY
----------------

Drop a foreign key.

See Foreign Keys for more information.

ADD INDEX
---------

Add a plain index.

Plain indexes are regular indexes that are not unique, and are not acting as a
primary key or a foreign key. They are also not the "specialized" FULLTEXT or
SPATIAL indexes.

See Getting Started with Indexes: Plain Indexes for more information.

DROP INDEX
----------

Drop a plain index.

Plain indexes are regular indexes that are not unique, and are not acting as a
primary key or a foreign key. They are also not the "specialized" FULLTEXT or
SPATIAL indexes.

See Getting Started with Indexes: Plain Indexes for more information.

ADD UNIQUE INDEX
----------------

Add a unique index.

The UNIQUE keyword means that the index will not accept duplicated values,
except for NULLs. An error will raise if you try to insert duplicate values in
a UNIQUE index.

For UNIQUE indexes, you can specify a name for the constraint, using the
CONSTRAINT keyword. That name will be used in error messages.

See Getting Started with Indexes: Unique Index for more information.

DROP UNIQUE INDEX
-----------------

Drop a unique index.

The UNIQUE keyword means that the index will not accept duplicated values,
except for NULLs. An error will raise if you try to insert duplicate values in
a UNIQUE index.

For UNIQUE indexes, you can specify a name for the constraint, using the
CONSTRAINT keyword. That name will be used in error messages.

See Getting Started with Indexes: Unique Index for more information.

ADD FULLTEXT INDEX
------------------

Add a FULLTEXT index.

See Full-Text Indexes for more information.

DROP FULLTEXT INDEX
-------------------

Drop a FULLTEXT index.

See Full-Text Indexes for more information.

ADD SPATIAL INDEX
-----------------

Add a SPATIAL index.

See SPATIAL INDEX for more information.

DROP SPATIAL INDEX
------------------

Drop a SPATIAL index.

See SPATIAL INDEX for more information.

ENABLE/ DISABLE KEYS
--------------------

DISABLE KEYS will disable all non unique keys for the table for storage
engines that support this (at least MyISAM and Aria). This can be used to
speed up inserts into empty tables.

ENABLE KEYS will enable all disabled keys.

RENAME TO
---------

Renames the table. See also RENAME TABLE.

ADD CONSTRAINT
--------------

Modifies the table adding a constraint on a particular column or columns.

MariaDB starting with 10.2.1
----------------------------
MariaDB 10.2.1 introduced new ways to define a constraint.

Note: Before MariaDB 10.2.1, constraint expressions were accepted in syntax,
but ignored.

ALTER TABLE table_name 
ADD CONSTRAINT [constraint_name] CHECK(expression);
Before a row is inserted or updated, all constraints are evaluated in the
order they are defined. If any constraint fails, then the row will not be
updated. One can use most deterministic functions in a constraint, including