Aggregate Functions : COUNT(), SUM(), AVG(), MIN(), MAX() | SQL- MySQL | Belayet Hossain
Belayet Hossain ??
Data Analyst @ZnZ ? Power BI, SQL, Excel, Python (ETL), MySQL, Oracle, DBeaver ? Find insight & Making Decision ? Ex-Head of Quality Dept & 09 Y With smartphone Manufacturing & Service ? Ex- RFL, VIVO, Symphony ? EEE
Aggregate Functions in SQL :
Aggregate functions in SQL perform calculations on a set of rows and return a single summary value. These functions are commonly used with the GROUP BY clause to group rows based on one or more columns.
?? Common Aggregate Functions
→ Syntax
SELECT aggregate_function(column_name)
FROM table_name
?? 1.? COUNT () : Returns the number of rows in a table.
→ Example: Count the number of student in the student table.
→ Syntax:
select count(*) as total_student
from student
→ Output: total_student - 5
?? 2.????? AVG () Function: Returns the average value of a numeric column.
→ Example: Find the average salary of employees in the employee table.
→ Syntax:
select avg(salary) as Avg_Salary
from employee
→ Output: Avg_Salary - 38,750
?? 3.? SUM () : Calculates the total sum of a numeric column.
领英推荐
→ Example: Calculate the total salary of all employees in the employee table.
→ Syntax:
select sum(salary) as Total_salary
from employee
→ Output: Total_salary 155,000
?? 4.????? MIN () : Returns the smallest value in a column.
→ Example: Find the minimum salary in the Employees table.
→ Syntax:
select min(salary) as Min_Salary
from employee
→ output: Min_Salary 10,000
?? 5.????? MAX () : Returns the maximum value in a column.
→ Example: Find the maximum salary in the Employees table.
→ Syntax:
select max(salary) as Max_Salary
from employee
→ output: Max_Salary 55,000
?
?? Key Points
#dataanalytics #dataanalyst #SQL #MySQL #powerbi #AgrregateFucntion #AVg #SUM #COUNT #MIN #MAX #hiring #tech #data #career #job
Data Analyst @ZnZ ? Power BI, SQL, Excel, Python (ETL), MySQL, Oracle, DBeaver ? Find insight & Making Decision ? Ex-Head of Quality Dept & 09 Y With smartphone Manufacturing & Service ? Ex- RFL, VIVO, Symphony ? EEE
2 个月??