elete 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. 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 UDF's. CREATE TABLE account_ledger ( id INT PRIMARY KEY AUTO_INCREMENT, transaction_name VARCHAR(100), credit_account VARCHAR(100), credit_amount INT, debit_account VARCHAR(100), debit_amount INT); ALTER TABLE account_ledger ADD CONSTRAINT is_balanced CHECK((debit_amount + credit_amount) = 0); The constraint_name is optional. If you don't prņ!