eolas/neuron/4e98d18e-1a79-4e78-a4ac-f7e3a2de9887/Aggregate_functions_in_SQL.md
2024-10-21 23:11:48 +01:00

556 B

tags
SQL
databases

Aggregate functions in SQL

Aggregate functions enable us to return data about the data that a table holds. For example the sum of a given column or its average.

Count return with custom variable

SELECT COUNT(*) AS total_sales
FROM SALES

Sum

SELECT SUM(price) as total_value
FROM sales

Average

SELECT AVG(price) as average_income
FROM sales

Applying aggregate function with sorting applied

SELECT COUNT(*) AS total_sales
FROM sales
GROUP BY employee_id