Summary: in this tutorial, we will certainly introduce you accumulation attribute concepts and also common SQL accumulation functions.
You are watching: Which of the following is not an aggregate function
Review to SQL aggregate functions
An accumulation feature allows you to percreate a calculation on a set of values to rerotate a single scalar value. We often use aggregate features with the GROUP BY and also HAVING clauses of the SELECT statement.
The adhering to are the most commonly offered SQL aggregate functions:
Notice that all accumulation attributes above overlook NULL values other than for the COUNT attribute.
SQL aggregate attributes syntax
To call an aggregate attribute, you usage the complying with syntax:
First, specify an accumulation attribute that you desire to usage e.g., MIN, MAX, AVG, SUM or COUNT.Second, put DISTINCT or ALL modifier followed by an expression inside parentheses. If you explicitly use theDISTINCT modifier, the aggregate feature ignores duplicate worths and just think about the unique values. If you usage theALL modifier, the aggregate feature provides all worths for calculation or testimonial. The ALL modifier is provided by default if you do not specify any kind of modifier clearly.
Let’s study the syntax over in better detail:
SQL accumulation function examples
Let’s take a look some examples of making use of SQL aggregate functions.
COUNT function example
To gain the number of commodities in the assets table, you usage the COUNT attribute as follows:
AVG feature example
To calculate the average systems in stock of the commodities, you use the AVG attribute as follows:
SUM function example
To calculate the amount of units in stock by product category, you use the SUM attribute through the GROUP BY clause as the following query:
MIN function example
To acquire the minimum systems in stock of products in the assets table, you use the MIN feature as follows:
MAX function example
To obtain the maximum devices in stock of products in the products table, you usage the MAX feature as displayed in the adhering to query:
See more: Calvin Agreed With Luther On Most Important Doctrines Except
In this tutorial, we have presented you to the SQL accumulation functions consisting of the many generally provided functions: AVG, COUNT, MIN, MAX, and also SUM.