This is an old revision of the document!
ALTER TABLE
Standard Syntax
ALTER TABLE tablename ( ADD|DROP COLUMN datatype [NULL|NOT NULL] [CONSTRAINTS], ADD|DROP COLUMN datatype [NULL|NOT NULL] [CONSTRAINTS], ... );
Adding a Primary Key
- alter table parcels add primary key (`id`);
Adding an Index/Key
- alter table parcels add key (`area`);
- alter table parcels add index (`owner`);
Converting to a Character Set
- alter table mytable CONVERT TO CHARACTER SET latin1;
- alter table mytable CONVERT TO CHARACTER SET latin1 [COLLATE collation_name];