0
3.4kviews
Write about Aggregate Functions in SQL.
1 Answer
0
27views
  • Aggregate functions perform a calculation on a set of values and return a single value.
  • Aggregate functions are frequently used with the GROUP BY clause of the SELECT statement.
  • All aggregate functions are deterministic. This means aggregate functions return the same value any time that they are called by using a specific set of input values.
  • Most Commonly used functions are as follows:

    AVG() - The SQL AVG aggregate function selects the average value for certain table column. Example: SELECT AVG(Goals) FROM Players;

    COUNT() - The SQL COUNT aggregate function is used to count the number of rows in a database table. Example: SELECT COUNT(*) FROM Players WHERE club = 'Chelsea';

    MAX() - The SQL MAX aggregate function allows us to select the highest (maximum) value for a certain column. Example: SELECT MAX(Goals) FROM Players;

    MIN() - The SQL MIN aggregate function allows us to select the lowest (minimum) value for a certain column. Example:SELECT MIN(Goals) FROM Players;

    SUM() - The SQL SUM aggregate function allows selecting the total for a numeric column. Example:SELECT SUM(Goals) FROM Players;

Please log in to add an answer.