数据库小试题2

世纪佳缘网面试题

1.统计每个分类(type)有多少人:

select type,count(type) from tab_user group by type;

2.统计五个人的总分(score)是多少:

 select sum(score) from tab_user;

3.按照分数(score)选出前三名,倒序排列:

select * from `tab_user` order by score desc limit 3;

4.插入数据:小明(name),4(type),30(score);

insert into `tab_user` (name,type,score) values ('小明','4','30');

5.更新50分一下(不含50分)的分数(score)为60;

update `tab_user`  set score = 60 where score<50;

6.删除分数(score)60分一下的数据。

DELETE from `tab_user` where score <60;
原文地址:https://www.cnblogs.com/yangzailu/p/7880592.html