Sobes.tech
Junior

Millised agregatsioonifunktsioonid kasutatakse koos rühmitamisega?

sobes.tech AI

Vastus AI-lt

Together with GROUP BY, the following SQL aggregate functions are used:

  • COUNT() - counts the number of rows in the 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;