mysql> select * from test;
+----+----------+-------+-----------+
| id | name | score | subject |
+----+----------+-------+-----------+
| | xiaoming | | shuxue |
| | xiaohong | | shuxue |
| | xiaohong | | english |
| | xiaohong | | physics |
| | xiaohong | | astronaut |
| | xiaoming | | physics |
| | xiaoming | | astronaut |
| | xiaoming | | english |
| | xiaobai | | astronaut |
| | xiaobai | | english |
| | xiaobai | | physics |
| | xiaobai | | shuxue |
| | xiaohei | | astronaut |
| | xiaohei | | shuxue |
| | xiaohei | | physics |
| | xiaohei | | english |
+----+----------+-------+-----------+
rows in set (0.00 sec) mysql> select name,avg(score) from test group by name;
+----------+------------+
| name | avg(score) |
+----------+------------+
| xiaobai | 80.0000 |
| xiaohei | 80.0000 |
| xiaohong | 82.2500 |
| xiaoming | 82.2500 |
+----------+------------+
rows in set (0.01 sec) mysql> select name,sum(score)/count(*) from test group by name;
+----------+---------------------+
| name | sum(score)/count(*) |
+----------+---------------------+
| xiaobai | 80.0000 |
| xiaohei | 80.0000 |
| xiaohong | 82.2500 |
| xiaoming | 82.2500 |
+----------+---------------------+
rows in set (0.00 sec)

最新文章

  1. window.name实现的跨域数据传输
  2. java中的23中设计模式(转)
  3. Android异常:唤醒锁未授权。(Caused by: java.lang.SecurityException: Neither user 10044 nor current process has android.permission.WAKE_LOCK.)
  4. iOS开发进阶
  5. 更新引用google的cdn外部jQuery核心库JS文件
  6. java学习之(接口)
  7. build a git repo and clone
  8. 【上传AppStore】iOS项目上传到AppStore步骤流程(第三章) - 基本信息总汇
  9. windows下部署 ISCSI存储
  10. Microsoft Visual Studio 2010 Service Pack 1(exe)
  11. 【破解】破解ACDSEE15的方法
  12. delphi edit编辑框使用
  13. MYSQL的日志与备份还原
  14. Odoo11入门请假单模块学习教程源码
  15. FTP、FTPS和SFTP
  16. C#(在WeBAPI)获取Oracle(在PL/SQL)游标类型的存储过程(用到了RefCursor)
  17. eclipse git(版本回退)
  18. 不同CSS技术及其CSS性能
  19. MySQL性能优化之道
  20. linux下subversion的安装

热门文章

  1. 浮动IP地址(Float IP)与 ARP欺骗技术
  2. 2-python元组和列表
  3. SpringCloud中服务发现-Eureka
  4. 【强烈推荐】ok-admin 一个好看又好用的后台模版!!!
  5. Hive函数集锦
  6. windows环境下安装mysql5.7.20
  7. 七、Linux_端口、进程
  8. 我感觉这个书上的微信小程序登陆写得不好
  9. G1垃圾收集器系统化说明【官方解读】
  10. nginx和tomcat配置负载均衡和session同步