Download presentation
Presentation is loading. Please wait.
Published byRonald Cobb Modified over 9 years ago
1
Said Salomon Unitrin Direct Insurance timelord@timelordshangout.com T-SQL Aggregate Functions Said Salomon
2
I have over 25 year experience IT. I have a vast array of abilities in the field in the areas of Network, Desktop Support, DBA, Staff Project Management, Application Software Development, Business Analysis and Quality Assurance. I have Microsoft certifications as MCTS, MCPS, and MCNPS, and multiple certifications from the Insurance Institute of America. Currently I am a DBA at Unitrin Direct Insurance.
3
AVGMIN CHECKSUM_AGGSUM COUNTSTDEV COUNT_BIGSTDEVP GROUPINGVAR MAXVARP
4
Returns the average of the values in a group. Syntax: AVG ( [ ALL | DISTINCT ] expression ) All Applies the aggregate function to all values. ALL is the default. DISTINCT Specifies that AVG be performed only on each unique instance of a value, regardless of how many times the value occurs. Expression Is an expression of the exact numeric or approximate numeric data type category, except for the bit data type. Aggregate functions and subqueries are not permitted.expression
5
Returns the checksum of the values in a group. Syntax: CHECKSUM_AGG ( [ ALL | DISTINCT ] expression ) All Applies the aggregate function to all values. ALL is the default. DISTINCT Specifies that CHECKSUM_AGG be performed only on each unique instance of a value, regardless of how many times the value occurs. Expression Is an expression of the exact numeric or approximate numeric data type category, except for the bit data type. Aggregate functions and subqueries are not permitted.
6
Returns the number of items in a group. Syntax: COUNT ( { [ [ ALL | DISTINCT ] expression ] | * } ) All Applies the aggregate function to all values. ALL is the default. DISTINCT Specifies that COUNT be performed only on each unique instance of a value, regardless of how many times the value occurs. Expression Is an expression of the exact numeric or approximate numeric data type category, except for the bit data type. Aggregate functions and subqueries are not permitted. * Specifies that all rows should be counted to return the total number of rows in a table.
7
Same as Count expect it returns bigint
8
Indicates whether a specified column expression in a GROUP BY list is aggregated or not. Syntax: GROUPING ( ) column_expression Is a column or an expression that contains a column in a GROUP BY clause.
9
Returns the maximum value in the expression. Syntax: MAX ( [ ALL | DISTINCT ] expression ) All Applies the aggregate function to all values. ALL is the default. DISTINCT Specifies that MAX be performed only on each unique instance of a value, regardless of how many times the value occurs. Expression Is an expression of the exact numeric or approximate numeric data type category, except for the bit data type. Aggregate functions and subqueries are not permitted.
10
Returns the minimum value in the expression. Syntax: MIN ( [ ALL | DISTINCT ] expression ) All Applies the aggregate function to all values. ALL is the default. DISTINCT Specifies that MIN be performed only on each unique instance of a value, regardless of how many times the value occurs. Expression Is an expression of the exact numeric or approximate numeric data type category, except for the bit data type. Aggregate functions and subqueries are not permitted.
11
Returns the sum of all the values. Syntax: SUM ( [ ALL | DISTINCT ] expression ) All Applies the aggregate function to all values. ALL is the default. DISTINCT Specifies that SUM be performed only on each unique instance of a value, regardless of how many times the value occurs. Expression Is an expression of the exact numeric or approximate numeric data type category, except for the bit data type. Aggregate functions and subqueries are not permitted.
12
Returns the statistical standard deviation of all values in the specified expression. Syntax: STDEV ( [ ALL | DISTINCT ] expression ) All Applies the aggregate function to all values. ALL is the default. DISTINCT Specifies that STDEV be performed only on each unique instance of a value, regardless of how many times the value occurs. Expression Is an expression of the exact numeric or approximate numeric data type category, except for the bit data type. Aggregate functions and subqueries are not permitted.
13
Returns the statistical standard deviation for the population for all values in the specified expression. Syntax: STDEVP ( [ ALL | DISTINCT ] expression ) All Applies the aggregate function to all values. ALL is the default. DISTINCT Specifies that STDEVP be performed only on each unique instance of a value, regardless of how many times the value occurs. Expression Is an expression of the exact numeric or approximate numeric data type category, except for the bit data type. Aggregate functions and subqueries are not permitted.
14
Returns the statistical variance of all values in the specified expression. Syntax: VAR ( [ ALL | DISTINCT ] expression ) All Applies the aggregate function to all values. ALL is the default. DISTINCT Specifies that VAR be performed only on each unique instance of a value, regardless of how many times the value occurs. Expression Is an expression of the exact numeric or approximate numeric data type category, except for the bit data type. Aggregate functions and subqueries are not permitted.
15
Returns the statistical variance for the population for all values in the specified expression. Syntax: VARP ( [ ALL | DISTINCT ] expression ) All Applies the aggregate function to all values. ALL is the default. DISTINCT Specifies that VARP be performed only on each unique instance of a value, regardless of how many times the value occurs. Expression Is an expression of the exact numeric or approximate numeric data type category, except for the bit data type. Aggregate functions and subqueries are not permitted.
16
Aggregate Functions (books Online) http://bit.ly/dAaXRlhttp://bit.ly/dAaXRl SQL Server 2008, Dev Edition http://bit.ly/L2hJQ http://bit.ly/L2hJQ My Twitter SaidSalomon
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.