141k views
5 votes
Write a query to find the sum minimum and maximum of the salaries of the employees sql

2 Answers

7 votes

Final answer:

To find the sum, minimum, and maximum of the salaries of the employees in SQL, you can use aggregate functions like SUM, MIN, and MAX.

Step-by-step explanation:

To find the sum, minimum, and maximum of the salaries of the employees, you can use SQL aggregate functions. The SUM function will give you the total sum of the salaries, the MIN function will give you the smallest salary, and the MAX function will give you the highest salary. Here is an example query:

SELECT SUM(salary) AS TotalSalary, MIN(salary) AS MinSalary, MAX(salary) AS MaxSalary FROM employees;

This query will calculate the total sum, minimum, and maximum salaries from the 'employees' table.

User NealR
by
8.3k points
7 votes

Final answer:

You can use the GROUP BY clause with the aggregate functions SUM(), MIN(), and MAX() to find the sum, minimum, and maximum of salaries in SQL.

Step-by-step explanation:

To find the sum, minimum, and maximum of the salaries of the employees in SQL, you can use the GROUP BY clause along with the aggregate functions SUM(), MIN(), and MAX(). Here's an example query:

SELECT SUM(salary) AS total_salary, MIN(salary) AS min_salary, MAX(salary) AS max_salary FROM employees;

In this query, we are selecting the total sum of salaries using SUM(), the minimum salary using MIN(), and the maximum salary using MAX() from the employees table.

User Spdaley
by
8.4k points