ALTER [IGNORE] TABLE table_name action_list
Description: Changes the structure of an existing table.
Usage: action_list can contain any number of actions separated by commas, with keywords whose syntax is listed in Table B.1.
Syntax for Action in action_list | Action Performed |
---|---|
ADD [COLUMN] column_declaration [FIRST | AFTER column_name] | Add a column to the table. |
ADD INDEX [index_name] (column_name,...) | Add an index on one or more columns, optionally named but otherwise taking its name from column_name, the first indexed column. |
ADD PRIMARY KEY (column_name,...) | Add a primary key. |
ADD UNIQUE [index_name] (column_name,...) | Add a unique key on one or more columns, optionally named but otherwise taking its name from ... |
Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.