Lost your password? Please enter your email address. You will receive a link and will create a new password via email.


You must login to ask a question.

You must login to add post.

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

RTSALL Latest Articles

You should know Aggregate functions in SQL-5

You should know Aggregate functions in SQL-5

Aggregate functions in SQL, Mostly use this function in SQL to find out the total sum, count, min, and max, etc. So you should know about it, learn the key concept and use it according to your requirement.

Define Select Average in SQL | Aggregate functions Query

The AVG() total capability will return the normal values chosen. The AVG() function returns the average value of an expression. Note: NULL values are ignored.

Example: To do this in SQL, you need to utilize a DISTINCT clause. You can see the annual_salary section in our representative’s table has values that rehash, for example, 5000 and 10000. In the event that we believe SQL should consider these qualities just a single time, we use AVG() with a DISTINCT clause.

SELECT AVG(Salary) FROM Employees

Aggregate functions can also be combined with the where clause.

SELECT AVG(Salary) FROM Employees where DepartmentId = 2

Assuming the worker is ordered with a different department and we need to find avg salary for each division then we can utilize the accompanying inquiry.

SELECT AVG(Salary) FROM Employees GROUP BY DepartmentId

Define Maximum Function in SQL.

The MAX() aggregate function will return the maximum of values selected.

SELECT MAX(Salary) FROM Employees

How I can use Count() Function in SQL?

The COUNT() aggregate function will return the count of values selected.

SELECT Count(*) FROM Employees
SELECT Count(*) FROM Employees where ManagerId IS NOT NULL
Select Count(ManagerId) from Employees

Define the Sum() function in SQL.

The SUM() aggregate function returns the sum of the values selected for all rows.

SELECT SUM(Salary) FROM Employees

Source: StackOverflow, W3Schools, Wikipedia

Read Also: Subqueries in  SQL | SQL Queries -P4

Commonly used SQL Queries | MSSQL Server

Related Posts

Leave a comment

You must login to add a new comment.