﻿ SQL: Find the total salary given to the MANAGER

# SQL Exercise: Find the total salary given to the MANAGER

## SQL subqueries on employee Database: Exercise-26 with Solution

[An editor is available at the bottom of the page to write and execute the scripts.]

26. From the following table, write a SQL query to compute the total salary of the designation MANAGER. Return total salary.

Sample table: employees

Sample Solution:

``````SELECT SUM (salary)
FROM employees
WHERE job_name = 'MANAGER';
``````

Sample Output:

```   sum
---------
8257.00
(1 row)
```

Explanation:

The given query in SQL that returns the total salary of all the employees from the employees table who have a job name of 'MANAGER'.

The aggregate function "SUM" calculates the total salary of all the matching employees.

Relational Algebra Expression:

Relational Algebra Tree:

## Practice Online

Structure of employee Database:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous SQL Exercise: Senior employees with grades over 3 work under KAYLING.
Next SQL Exercise: Display the total salary of employees with grade 3.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.

﻿