PostgreSQL Aggregate Functions and Group By- Exercises, Practice, Solution
PostgreSQL Aggregate Functions and Group by [14 exercises with solution]
1. Write a query to find the number of jobs available in the employees table.
Sample table: employees
2.Write a query to get the total salaries payable to employees.
Sample table: employees
3. Write a query to get the minimum salary from employees table.
Sample table: employees
4. Write a query to get the maximum salary of an employee working as a Programmer.
Sample table: employees
5. Write a query to get the average salary and number of employees working in the department which ID is 90.
Sample table: employees
6. Write a query to get the highest, lowest, total, and average salary of all employees.
Sample table: employees
7. Write a query to get the number of employees working in each post.
Sample table: employees
8. Write a query to get the difference between the highest and lowest salaries.
Sample table: employees
9. Write a query to find the manager ID and the salary of the lowest-paid employee under that manager.
Sample table: employees
10. Write a query to get the department ID and the total salary payable in each department.
Sample table: employees
11. Write a query to get the average salary for each post excluding programmer.
Sample table: employees
12. Write a query to get the total salary, maximum, minimum and average salary of all posts for those departments which ID 90.
Sample table: employees
13. Write a query to get the job ID and maximum salary of each post for maximum salary is at or above $4000.
Sample table: employees
14. Write a query to get the average salary for all departments working more than 10 employees.
Sample table: employees
... More
Structure of 'hr' database :
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/postgresql-exercises/aggregate-function-and-groupby/
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics