求score表中的成绩按各科平均分的高低排列成绩--面试题目 mysql排序面试题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 mysql> select a.* From score A join ( -> SELECT cno,sum(degree)/count(*) as Avg -> FROM score Group by cno )B on A.cno=B.cno -> order by b.avg,a.degree;+-----+-------+--------+| SNO | CNO | DEGREE |+-----+-------+--------+| 109 | 3-245 | 68.0 || 105 | 3-245 | 75.0 || 103 | 3-245 | 86.0 || 107 | 6-106 | 79.0 || 101 | 3-105 | 64.0 || 109 | 3-105 | 76.0 || 108 | 3-105 | 78.0 || 105 | 3-105 | 88.0 || 107 | 3-105 | 91.0 || 103 | 3-105 | 92.0 || 108 | 6-166 | 81.0 || 101 | 6-166 | 85.0 |+-----+-------+--------+12 rows in set (0.00 sec)mysql> 停掉mysql服务之后为什么还有这么多mysql 求:取出记录的总和要符合某个条件 mysql中使用exists,出错,达人帮看一下 怎么在mysql中查看当前mysql承载的所有sql语句? 数据库同步问题? 求助:下了个免安装版,但运行报错??? 请问mysql支持的最长的sql语句能有多少字符? Mysql 中的数据库删除出错问题? mysql下面如何把字符串编码 mysql 一个本地数据库和一个远程数据库的事务 请教linux下mysql 存储过程的报错问题 一个简单的mysql语句,求解?
mysql> select a.* From score A join (
-> SELECT cno,sum(degree)/count(*) as Avg
-> FROM score Group by cno )B on A.cno=B.cno
-> order by b.avg,a.degree;
+-----+-------+--------+
| SNO | CNO | DEGREE |
+-----+-------+--------+
| 109 | 3-245 | 68.0 |
| 105 | 3-245 | 75.0 |
| 103 | 3-245 | 86.0 |
| 107 | 6-106 | 79.0 |
| 101 | 3-105 | 64.0 |
| 109 | 3-105 | 76.0 |
| 108 | 3-105 | 78.0 |
| 105 | 3-105 | 88.0 |
| 107 | 3-105 | 91.0 |
| 103 | 3-105 | 92.0 |
| 108 | 6-166 | 81.0 |
| 101 | 6-166 | 85.0 |
+-----+-------+--------+
12 rows in set (0.00 sec)mysql>