w3resource
SQL exercises

SQL Subquery Exercises: Find the departments which sanction amount is larger than the average sanction amount of all the departments

SQL SUBQUERY: Exercise-37 with Solution

37. Write a query in SQL to find the departments which sanction amount is larger than the average sanction amount of all the departments.

Sample table: emp_department

Sample Solution:

SELECT *
  FROM emp_department
  WHERE dpt_allotment >
  (
    SELECT AVG(dpt_allotment)
    FROM emp_department
  );

Output:

SQL Subqueries : Find the departments which sanction amount is larger than the average sanction amount of all the departments

Practice Online


Sample Database:

Model Database

Query Visualization:

Duration:

Query visualization of Find the departments which sanction amount is larger than the average sanction amount of all the departments - Duration

Rows:

Query visualization of Find the departments which sanction amount is larger than the average sanction amount of all the departments - Rows

Cost:

Query visualization of Find the departments which sanction amount is larger than the average sanction amount of all the departments - Cost

Contribute your code and comments through Disqus.

Previous: Write a query in SQL to display the first name and last name of employees working for the department which allotment amount is more than Rs.50000.
Next: Write a query in SQL to find the names of departments with more than two employees are working.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming