14 solved exercises

Group By

Solutions and examples for MySQL.

Showing 1–14 of 14 problems

  1. 01Show each region_id and corresponding no of countries in that region from countries table
  2. 02Show the location_id and corresponding no of departments in that location from departments table
  3. 03For each department_id, show the no of employees in that department from the employees table
  4. 04For each manager_id, show the no of employees under his supervision from the employees table
  5. 05For each job_id, show the no of employees in that job type from the employees table
  6. 06For each department_id, show the no of managers from that department using employees table
  7. 07Show the department wise total no of employees, maximum and minimum salary in that department, average and total salary paid for that department from the employees table
  8. 08For each year, show the total no of employees who were hired during that year from the employees table
  9. 09Show the total no of jobs within 0k to 10k, 10k to 20k and so on salary ranges(max_salary-min_salary) groups from the jobs table
  10. 10For each job_id and each department, show the total no of employees in that group from the employees table
  11. 11For each year and each month show the total no of employees who have left their jobs from the job_history table
  12. 12For each country_id, show the total no of locations in that country from the locations table
  13. 13For each city, show the total no of locations in that city from the locations table
  14. 14Group employees based on the first letter of their names