MySQL数据库基础练习题

1.create table student(id char() primary key not null,name char(),come_from char(),math_scores int());

2.insert into student(id, name, from, math_scores) values (200604,'王五','山东',89)

3. delete from student1 where name like '%海%';    # 删除名字中有海字的信息

4.select count(*) from student1 where come_from='山东';    # 汇总是山东的同学数量

5.select * from student1 order by math_scores desc;    # 按成绩升序

6.alter table student1 add phone varchar(20);    # 增加列

7.select id,name from student1 limit 3;    # 查询前三行数据

8.update student1 set math_scores=math_scores+10 where math_scores<60;    # 为成绩低于60分的同学增加10分  也可以用于更新数据

9.create unique index student_id_idx on student(id[ASC]);  # 建立唯一索引的列上不能有重复的值,即该列要满足not null和unique约束,默认是升序,降序则写[DESC]

10.drop table student1;    # 删除表

11.alter table student2 drop column home;    # 删除列


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

林丑丑@

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值