Table of Contents
SQL Statements Implemented in MySQL
Alter Table
ALTER [IGNORE] TABLE tbl_name action[, action …]
In this code, action refers to an action as defined below. ALTER TABLE queries may be used to change the definition of a table without losing any of the information in that table (except in obvious cases, such as the deletion of a column). Here are the main actions that are possible:
ADD [COLUMN] create_definition [FIRST | AFTER column_name]
ADD INDEX [index_name] (index_col_name, …)
ADD FULLTEXT [index_name] (index_col_name, …)
ADD PRIMARY KEY (index_col_name, …)
ADD UNIQUE [index_name] (index_col_name, …)
ALTER [COLUMN] col_name {SET DEFAULT value | DROP DEFAULT}
CHANGE [COLUMN] col_name create_definition
DISABLE KEYS / ENABLE KEYS
DROP [COLUMN] col_name
DROP PRIMARY KEY / DROP INDEX index_name
MODIFY [COLUMN] create_definition
ORDER BY col_name
RENAME [TO] new_tbl_name
table_options
Analyze table
ANALYZE TABLE tbl_name[, tbl_name, …]
