DEV Community

Punitha
Punitha

Posted on

SQL Functions

What are SQL Functions?

SQL functions perform calculations on data and return a result.

  • COUNT()

  • SUM()

  • AVG()

  • MIN()

  • MAX()

COUNT()

  • Returns the total number of rows.
SELECT COUNT(*)
FROM Employee;
Enter fullscreen mode Exit fullscreen mode

SUM()

  • Returns total value of a numeric column.
SELECT SUM(Salary)
FROM Employee;
Enter fullscreen mode Exit fullscreen mode

AVG()

  • Returns the average value.
SELECT AVG(Salary)
FROM Employee;
Enter fullscreen mode Exit fullscreen mode

MIN()

  • Returns the smallest value.
SELECT MIN(Salary)
FROM Employee;
Enter fullscreen mode Exit fullscreen mode

MAX()

  • Returns the largest value.
SELECT MAX(Salary)
FROM Employee;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)