查看表
show tables;
創建表
create Table table_name (
? 屬性名? 數據類型 ,
? 屬性名? 數據類型 ,
?? ....
? 屬性名? 數據類型 ,
);
?查看表結構
desc table_name ;
刪除表
drop Table table_name ;
修改表名
alter table table_name?
????? rename new_table_name;
增加字段(最后)
alter table table_name
??? add 屬性名 屬性類型;
增加字段(最前)
alter table table_name
??? add 屬性名 屬性類型 first;
在某字段之后增加字段
alter table table_name
??? add 屬性名 屬性類型
?? ? ?? after 屬性名;
刪除字段
alter table table
??? drop 屬性名;
修改字段的名字(和數據類型)
alter table table_name
??? change 舊屬性名 新屬性名 舊(新)數據類型
修改字段的順序
alter table table_name
??? modify 屬性名1 數據類型 first | after 屬性名2