文章目录
Mysql语句练习
建一张表
首先新建一个数据库:
create database practice;
然后进入这个数据库:
use practice;
建一张Student表:
create table Student(
Sno char(5) not null unique,
Sname char(20),
Ssex char(2),
Sage int,
Sdept char(15),
);
查询数据库中所有的表
show tables;
查询此表的字段
show columns from Student;
将年龄的数据类型改为半字长整数:
alter table Student modify Sage smallint
删除关于学号必须取唯一值的约束
alter table Student drop index Sno;
添加新的字段:
alter table Student add Scome date;
删除一个字段名:
alter table Student drop column Ssex;
删除表:
drop table Student;
转载:https://blog.csdn.net/MercyFreedom/article/details/101468378
查看评论