输入banner图图片脚本导航/分类

MySQL练习

-- 1 查询Student表中的所有记录的Sname、Ssex和Class列。

select sname,ssex,class from student;

 

 技术图片

 

 

-- 2 查询教师所有的单位即不重复的Depart列。

select depart,group_concat(tname) from teacher group by depart;

 技术图片

 

-- 3 查询Student表的所有记录。

Select*fromstudent;

 技术图片

 

 

-- 4 查询Score表中成绩在60到80之间的所有记录。

Select * from score where degree between 60 an 80;

 

 技术图片

 

 

-- 5 查询Score表中成绩为85,86或88的记录。

Select * from score where degree in (85,86,88);

 技术图片

 

-- 6 查询Student表中"95031"班或性别为"?"的同学记录。

Select * from student where class=’95031’ or ssex=’女’;

 

技术图片

 

 

-- 7 Class降序查询Student表的所有记录。

Select * from student order by class desc;

 

 技术图片

 

 

-- 8 Cno升序、Degree降序查询Score表的所有记录。

Select * from score order by cno asc,degree desc;

 技术图片

 

-- 9 查询"95031"班的学??数。

Select count(*) from student where class=’95031’

 技术图片

 

-- 10 查询Score表中的最?分的学?学号和课程号。(?查询或者排序)

Select sno,cno from score where degree=(select Max(degree) from score);

 技术图片

 

-- 10.1 查询Score表中除了每?课程最?分的学?学号和课程号。(?查询或者排序)

Select sno,cno from score where degree not in (select Max(degree) from score group by cno);

 技术图片

 

 

拔?题: -- 11、查询每?课的平均成绩。 -- 12、查询Score表中?少有5名学?选修的并以3开头的课程的平均分数。 -- 13、查询分数?于70,?于90的Sno列。 -- 14、查询所有学?的Sname、Cno和Degree列。 -- 15、查询所有学?的Sno、Cname和Degree列。 -- 16、查询所有学?的Sname、Cname和Degree列。 -- 17、查询"95033"班学?的平均分。  

MySQL练习

标签:esc   date   不重复   group   hda   loading   datetime   mic   img