SQL语句练习
给两张表,连表查询各科成绩前三名 SELECT a.*,u.* from score a INNER JOIN user u on a.id=u.id where (SELECT count(*) from score b where a.course=b.course and b.score>=a.score)<3 ORDER BY a.course,a.score desc 查询学生表每门课都大于80 分的学生姓名 select name from student group by name HAVING min(score) >80 and count(kemu) >=3 求排名第5到10的部门的平均工资(limit(a,b) a为偏移量,b为size #limit后面如果只写一个整数n,那就是查询的前n条记录;如果后面带2个整数n 和 m,那么第一个数n就是查询出来队列的起点(从0开始),第二个是m是统计的总数目 select avg(salary) from department de group by dep order by avg(salary) desc limit(5,6) 求职员表name和department。分别表示员工姓名和所属部门,请写一条SQL语句查出每个部门的人数 select department.name, count(DISTINCT id)