Junior — Middle
Can you list the main aggregation functions used in SQL for data analysis?
sobes.tech AI
Answer from AI
Main aggregation functions in SQL used for data analysis:
COUNT()— counts the number of rows.SUM()— calculates the sum of values in a column.AVG()— calculates the average value.MIN()— finds the minimum value.MAX()— finds the maximum value.
Example of usage:
SELECT department, COUNT(*) AS employee_count, AVG(salary) AS average_salary
FROM employees
GROUP BY department;
This query counts the number of employees and the average salary for each department.