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的类来一起分析聚合函数的是如果 ...
随机推荐
- codevs1026-dp(记忆化搜索)
题目描述 Description 年轻的拉尔夫开玩笑地从一个小镇上偷走了一辆车,但他没想到的是那辆车属于警察局,并且车上装有用于发射车子移动路线的装置. 那个装置太旧了,以至于只能发射关于那辆车的移动 ...
- HTML——表单
总结: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8 ...
- C# 加密、解密函数
#region ========加密======== /// <summary> /// 加密 /// </summary> /// <param name=" ...
- sqlsever 判断某个字段出现重复的字母或字符
-------下面使用标量值函数判断 出现重复的个数 create function fn_str_times(@str varchar(1000),--原子符串@indexstr varchar( ...
- vuejs vue-resource post方式提交参数PHP $_POST获取不到
- kubernetes-平台日志收集(ELK)
使用ELK Stack收集Kubernetes平台中日志与可视化 K8S系统的组件日志 K8S Cluster里面部署的应用程序日志 日志系统: ELK安装 安装jdk [root@localhost ...
- SC || 解决在git中上传过大文件的问题(如何将提交过的彻底删除
就在我在ddl前续命的时候……不知道怎么想不开,把v2的压力测试的日志(500多M)也往github上传 之前听说过好多因为传了大文件的锅…… 我竟然还想不开的往上传…… 真实又傻又蠢又自闭(T T ...
- DROP INDEX - 删除一个索引
SYNOPSIS DROP INDEX name [, ...] [ CASCADE | RESTRICT ] DESCRIPTION 描述 DROP INDEX 从数据库中删除一个现存的索引. 要执 ...
- SpringMVC的controller层的方法返回值
1.ModelAndView 既带着数据,又返回视图路劲 2.String 返回试图路径 model带数据 (官方或企业推荐使用此种方式 ,此方法符合解耦思想,即数据,视图,分离 MVC) 3. ...
- IOS中将颜色转换为image
- (UIImage *)createImageWithColor:(UIColor *)color { CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f ...