当前位置:网站首页>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
边栏推荐
- 搜索二维矩阵[二分巧用 + 记录不同于插入二分的解法]
- Sumati GameFi生态纵览,神奇世界中的元素设计
- Expectation and variance
- Which account is safer and better for access letter
- Redis 那些事
- Chinese and English instructions of Papain
- Taishan Office Technology Lecture: a simple study of Chinese punctuation in vertical arrangement
- Deoxyribonuclease I instructions in Chinese and English
- Install mysql5.6 under linux64bit - the root password cannot be modified
- RedisTemplate操作Redis,这一篇文章就够了(一)[通俗易懂]
猜你喜欢

Application session coverage solutions with different ports on the same server

Abnova a4gnt polyclonal antibody

JVM directive

Icml2022 | establishing a continuous time model of counterfactual results using neural control differential equations

Multi modal data can also be Mae? Berkeley & Google proposed m3ae to conduct Mae on image and text data! The optimal masking rate can reach 75%, significantly higher than 15% of Bert

第04天-文件IO
![最长连续序列[扩散法+空间换时间]](/img/db/7b0d1b0db7015e887340723505153a.png)
最长连续序列[扩散法+空间换时间]

Fake wireless speakers in stores? Sony responded: the product has reserved a wired connection interface, which can be used in complex scenarios

Abnova丨A4GNT多克隆抗体中英文说明

Sumati GameFi生态纵览,神奇世界中的元素设计
随机推荐
Fan benefits, JVM manual (including PDF)
Reverse ordinal number by merge sort
MPLS notes Part 1
Chrysanthemum chain (winter vacation daily question 39)
js数组对象转对象
1. package your own scaffold 2 Create code module
论文翻译 | RandLA-Net: Efficient Semantic Segmentation of Large-Scale Point Clouds
Stocking but not completely stocking (daily question 2 in spring)
sql 聚合函数对 null 的处理[通俗易懂]
Abnova丨A4GNT多克隆抗体中英文说明
Abnova丨BSG 单克隆抗体中英文说明
Unity C # e-learning (VI) -- FTP (II)
ICML2022 | 用神经控制微分方程建立反事实结果的连续时间模型
Abnova丨5-甲基胞嘧啶多克隆抗体中英文说明
Abnova CSV magnetic beads description in Chinese and English
修身励学篇
Notes on BGP part of CCNP
CCNP的BGP部分笔记
Is GF futures safe? What do I need to open an account?
脱氧核糖核酸酶I中英文说明书