删除列:ALTER TABLE tb1_name DROP[COLUMN] col_name;
添加多列:ALTER TABLE tb1_name ADD[COLUMN] (col_name column_definition,...);
添加单列:ALTER TABLE tb!_name ADD[COLUMN] col_name column_definition [FIRST|AFTER col_name];
条件删除:DELETE FROM province WHERE id=3;
添加主键约束 ALTER TABLE table_name ADD [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,...)
添加唯一约束 ALTER TABLE table_name ADD [CONSTRAINT [symbol]] UNIQUE [INDEX | KEY] [index_name] [index_type] (index_col_name, ...)
添加外键约束 ALTER TABLE table_name ADD [CONSTRAINT [symbol]] FOREIGN KEY [index_name] (index_col_name, ...) REFERENCES_definition;
添加外键约束:ALTER TABLE users2 ADD FOREIGN KEY(pid) REFERENCES provinces (id);
添加默认约束:ALTER TABLE users2 ALTER age SET DEFAULT 15;
删除默认约束:ALTER TABLE users2 ALTER age DROP DEFAULT;
修改定义列
ALTER TABLE tb1_name MODIFY [COLUMN] col_name column_definition [FIRST|AFTER col_name]
ALTER TABLE table_name id SAMLLINT UNSIGNED NOT NULL FIRST; // 把id放到第一列
修改列名称
ALTER TABLE table_name CHANGE [COLUMN] old_col_name new_col_name column_deinition [FIRST|AFTER col_name]
ALTER TABLE users CHANGE pid p_id TINYINT UNSIGNED NOT NULL