w3resource_MySQL练习: Aggregate_functions
-- 要点:count() + distinct select count(distinct job_id) from employees
-- 要点:sum() select sum(salary) from employees
-- 要点:min() select min(salary) from employees
-- 要点:max() select max(salary) from employees where job_id = 'IT_PROG'
-- 要点:avg() + count() select avg(salary), count(*) from employees where department_id=90
-- 要点:max() + min() + sum() + avg() select max(salary), min(salary), sum(salary), avg(salary)
-- 要点:group by进行分组 select job_id, count(*) from employees group by job_id
-- 要点:max() + min() select max(salary)-min(salary) from employees
-- 要点:根据manager_id进行分组,得到每个分组内最低的salary(min) select manager_id, min(salary) from employees group by manager_id
-- 要点:根据department_id进行分组,得到每个分组内salary总和(sum) select department_id, sum(salary) from employees group by department_id
-- 要点:通过job_id进行分组,得到每个分组内平均的salary(avg), select job_id, avg(salary) from employees where job_id<>'IT_PROG' group by job_id
-- 要点:同上,通过job_id进行分组,得到每个组内相应数值,并且使用where进行department_id筛选 select job_id, sum(salary), max(salary), min(salary), avg(salary) from employees where department_id=90 group by job_id
-- 要点:分组后的条件限制,使用having select job_id, max(salary) from employees group by job_id having max(salary)>=4000
-- 要点:同上,分组后使用having select department_id, avg(salary) from employees group by department_id having count(salary)>10
w3resource_MySQL练习: Aggregate_functions的更多相关文章
- w3resource_MySQL练习:Joins
w3resource_MySQL练习题:Joins 1. Write a query to find the addresses (location_id, street_address, city, ...
- w3resource_MySQL练习:Subquery
w3resource_MySQL练习题:Subquery 1. Write a query to find the name (first_name, last_name) and the salar ...
- w3resource_MySQL练习:Basic_select_statement
w3resource_MySQL练习题:Basic_select_statement 1. Write a query to display the names (first_name, last_n ...
- CentOS7安装性能监控系统
目录 系统描述. 开发环境. 开始之前. 安装influxdb数据库. 安装collectd 安装Grafana FAQ influxdb的web界面没反应. 系统描述 想打造 New ...
- ClickHouse源码笔记2:聚合流程的实现
上篇笔记讲到了聚合函数的实现并且带大家看了聚合函数是如何注册到ClickHouse之中的并被调用使用的.这篇笔记,笔者会续上上篇的内容,将剖析一把ClickHouse聚合流程的整体实现. 第二篇文章, ...
- Mybatis分页插件: pageHelper的使用及其原理解析
在实际工作中,很进行列表查询的场景,我们往往都需要做两个步骤:1. 查询所需页数对应数据:2. 统计符合条件的数据总数:而这,又会导致我们必然至少要写2个sql进行操作.这无形中增加了我们的工作量,另 ...
- ClickHouse源码笔记5:聚合函数的源码再梳理
笔者在源码笔记1之中分析过ClickHouse的聚合函数的实现,但是对于各个接口函数的实际如何共同工作的源码,回头看并没有那么明晰,主要原因是没有结合Aggregator的类来一起分析聚合函数的是如果 ...
随机推荐
- 线程池(1)ThreadPoolExecutor梳理
使用默认的 thread factory创建ThreadPoolExecutor实例 public ThreadPoolExecutor(int corePoolSize, int maximumPo ...
- NET Core2
NET Core的介绍 .NET Core 是一个通用开发平台,它由微软和开源社区共同管理(git hub的.NET开源社区): 他支持Windows,macOS和Linux,并且可以运行在硬件设 ...
- java Integer
Java 中的数据类型分为基本数据类型和引用数据类型 int是基本数据类型,Integer是引用数据类型: Ingeter是int的包装类,int的初值为0,Ingeter的初值为null. 初始化 ...
- (转)通过MySQL复制线程SQL_Thread加快增量恢复binlog
数据回档常常是使用全量备份+binlog增量实现的.而数据量很大的情况下,增量恢复binlog一直是一个苦恼的问题,因为恢复binlog速度十分慢,并且容易出错. 恢复binlog文件一般有两种方法: ...
- 策略模式和php实现
策略模式: 策略模式(Strategy Pattern):定义一系列算法,将每一个算法封装起来,并让它们可以相互替换.策略模式让算法独立于使用它的客户而变化,也称为政策模式(Policy). 策略模式 ...
- ECShop怎么首页调用文章列表
举例如首页调用方法:1.先打开index.php文件找到以下代码:$smarty->assign('new_articles', index_get_new_articles()); // 最新 ...
- Android 自定义Android ORM 框架greenDAO数据库文件的路径
import android.content.Context; import android.content.ContextWrapper; import android.database.Datab ...
- 【extjs6学习笔记】0.1 准备:基础概念(02)
Ext 类 Ext 是一个全局单例的对象,在 Sencha library 中它封装了所有的类和许多实用的方法.许多常用的函数都定义在 Ext 对象里.它还提供了像其他类中一些频繁使用的方法的快速调用 ...
- 一键部署joomla开源内容管理平台
https://market.azure.cn/Vhd/Show?vhdId=10896&version=12949 产品详情 产品介绍Joomla是一套自由.开放源代码的内容管理系统,以PH ...
- 清理winsxs文件夹(系统更新文件)的第三方工具
工具名称(第三方): Windows Update Clean Tool 下载地址: http://www.xiazaiba.com/html/24145.html http://dx5.xiazai ...