MySQL 查询 一

 

student表

teacher 表

course 表

score 表

查询student中所有记录

查询student表中所有记录中的sname、ssex、class列

查询教师所有单位不重复的depart列

distinct排除重复列。

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

 between  and 

查询score表中成绩为85、86、88的记录。

in 范围

查询student表中“95031”班或(与)性别“女”的同学记录。

以class降序查询student表中的所有记录。

以cno升序、degree降序查询score表中的所有记录。

查询“95031”班的学生人数。

统计count

查询score表中的最高分的学生号和课程号。

select max (degree) from score 找到最高分

select sno ,cno from score where degree=max 找最高分sno、cno.

limit  前数第几个数开始 后数差几个数 limit 0,1 0个数开始的一个数。

查询每门课的平均成绩

group by 分组

 

posted @ 2019-02-16 11:58  ~释然、  阅读(218)  评论(0)    收藏  举报