当前位置:网站首页>What are the SQL aggregate functions
What are the SQL aggregate functions
2022-06-25 01:56:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Aggregate functions are functions that perform calculations on a set of values and return a single value , It is often associated with SELECT Of the statement GROUP BY Clauses are used together ,SQL SERVER What aggregate functions are there in the ? Let's take a look at them one by one :
1. AVG Returns the average value in the specified group , Null values are ignored .
example :select prd_no,avg(qty) from sales group by prd_no
2. COUNT Returns the number of items in the specified group .
example :select count(prd_no) from sales
3. MAX Returns the maximum value of the specified data .
example :select prd_no,max(qty) from sales group by prd_no
4. MIN Returns the minimum value of the specified data .
example :select prd_no,min(qty) from sales group by prd_no
5. SUM Returns the sum of the specified data , Can only be used for numeric Columns , Null values are ignored .
example :select prd_no,sum(qty) from sales group by prd_no
6. COUNT_BIG Returns the number of items in the specified group , And COUNT The function is different from COUNT_BIG return bigint value , and COUNT The return is int value .
example :select count_big(prd_no) from sales
7. GROUPING Generate an additional column , When used CUBE or ROLLUP Operator to add a row , The output value is 1. When the added line is not by CUBE or ROLLUP When it comes into being , The output value is 0.
example :select prd_no,sum(qty),grouping(prd_no) from sales group by prd_no with rollup
8. BINARY_CHECKSUM Returns the binary check value calculated on the row or expression list in the table , Used to detect changes to rows in a table .
example :select prd_no,binary_checksum(qty) from sales group by prd_no
9. CHECKSUM_AGG Returns the check value of the specified data , Null values are ignored .
example :select prd_no,checksum_agg(binary_checksum(*)) from sales group by prd_no
10. CHECKSUM Returns the check value calculated on the row of the table or on the expression list , Used to generate hash index .
11. STDEV Returns the statistical standard deviation of all values in a given expression .
example :select stdev(prd_no) from sales
12. STDEVP Returns the filled statistical standard deviation of all values in a given expression .
example :select stdevp(prd_no) from sales
13. VAR Returns the statistical variance of all values in a given expression .
example :select var(prd_no) from sales
14. VARP Returns the statistical variance of the population of all values in a given expression .
example :select varp(prd_no) from salesPublisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/151864.html Link to the original text :https://javaforall.cn
边栏推荐
- 【LeetCode】11、盛最多水的容器
- Excel Chinese character to pinyin "suggestions collection"
- 泰山OFFICE技术讲座:竖排时中文标点的简单研究
- (CVPR 2020) Learning Object Bounding Boxes for 3D Instance Segmentation on Point Clouds
- uni-app集成极光推送插件后真机调试提示“当前运行的基座不包含原生插件[JG-JPush]...”问题的解决办法
- RedisTemplate操作Redis,这一篇文章就够了(一)[通俗易懂]
- Basic use of transformers Library
- AssertionError: CUDA unavailable, invalid device 0 requested
- (CVPR 2020) Learning Object Bounding Boxes for 3D Instance Segmentation on Point Clouds
- MeterSphere開源持續測試平臺與阿裏雲雲效DevOps的集成
猜你喜欢

Sumati GameFi生态纵览,神奇世界中的元素设计

实验5 8254定时/计数器应用实验【微机原理】【实验】

Abnova CSV magnetic beads description in Chinese and English

PS5连接OPPO K9电视不支持2160P/4K

ICML2022 | 用神经控制微分方程建立反事实结果的连续时间模型

Hands on data analysis data modeling and model evaluation

第04天-文件IO

MeterSphere開源持續測試平臺與阿裏雲雲效DevOps的集成

谷歌浏览器控制台 f12怎么设置成中文/英文 切换方法,一定要看到最后!!!
![uni-app集成极光推送插件后真机调试提示“当前运行的基座不包含原生插件[JG-JPush]...”问题的解决办法](/img/8b/0e982711c225ec8b0a2b90819d8a11.png)
uni-app集成极光推送插件后真机调试提示“当前运行的基座不包含原生插件[JG-JPush]...”问题的解决办法
随机推荐
Longest continuous sequence [diffusion method + space for time]
JVM directive
Full arrangement ii[duplicate removal of the same elements + standard backtracking]
PMP考试“临门一脚”如何踢得漂亮?
Chinese and English instructions of Papain
安超云:“一云多芯”支持国家信创政务云落地
write a number of lines to a new file in vim
你知道你的ABC吗(春季每日一题 1)
LogMiner 数据库日志挖掘
Elastase instructions in Chinese and English
Day 04 - file IO
在两个有序数组中找到整体第K小的数可以做到O(log(Min(M,N)))
Preg in PHP_ How to replace variable data
字符串数组转换为list集合
同一服务器两个端口不同的应用session覆盖解决方案
谈谈飞书对开发工作的优势 | 社区征文
sql 聚合函数有哪些
Basic use of transformers Library
MOS管相关知识
IPC机制