MySQL SQL 语句
2023/5/12小于 1 分钟约 155 字
MySQL SQL 语句
获取表的描述
desc 表名;修改表
添加列(add)
alter table 表名 add 列名 列的类型 [列的约束];
alter table student add score int not null;修改列(modify)
alter table 表名 modify 列名 列的类型 [列的约束];
alter table student modify sex varchar(1);修改列(change),包含列名
alter table 表名 change 列名 新列名 列的类型 [列的约束];
alter table student change sex gender varchar(1);删除列(drop)
alter table 表名 drop 列名;
alter table student drop score;修改表名(rename)
rename table 旧表名 to 新的表名尽量不要使用