Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/yybk426/article/details/80940977
View table:
desc 表名;
Modify the table name:
alter table 表名 rename to 新表名;
Add a column:
Execute the following command, the default column fields added to the end of the table
alter table 表名 add column 列名 varchar(30);
(After setting located in a field) If you want to specify the field location, you can use the first mysql provided (set to the first column) and after First and only used to add keywords after clause
设定为第一列:alter table 表名 add 字段名 字段类型 first
设定位于某个字段之后:alter table 表名 add 字段名 字段类型 after 字段名
Delete Column:
alter table 表名 drop column 列名;
Modify the column name:
alter table 表名 change 列名 新列名 varchar(30);
Modify column properties:
alter table 表名 modify 列名 varchar(22);
Modify the field Default:
alter table 表名 alter 字段名 set default 1000;
Delete field default values:
alter table 表名 alter 列名 drop default;
Review the default values of the fields in the table:
show columns from 表名
Modify the data table types:
You can use the alter command and type clause to complete. Type the following command to modify the list of students myisam
alter table student engine= myisam;