Junior
What aggregate functions are used together with grouping?
sobes.tech AI
Answer from AI
The following aggregate functions are used together with the GROUP BY clause in SQL:
COUNT()- counts the number of rows in a group.SUM()- calculates the sum of values in a numeric column of the group.AVG()- calculates the average value in a numeric column of the group.MIN()- finds the minimum value in the group.MAX()- finds the maximum value in the group.
For example:
SELECT
category,
COUNT(*) AS total_products,
SUM(price) AS total_price,
AVG(price) AS average_price
FROM
products
GROUP BY
category;