6 kyu
SQL Bug Fixing: Fix the JOIN
9,356matt c
Description:
Oh no! Timmys been moved into the database divison of his software company but as we know Timmy loves making mistakes. Help Timmy keep his job by fixing his query...
Timmy works for a statistical analysis company and has been given a task of calculating the highest average salary for a given job, the sample is compiled of 100 applicants each with a job and a salary. Timmy must display each unique job, the total average salary, the total people and the total salary and order by highest average salary. Timmy has some bugs in his query, help Timmy fix his query so he can keep his job!
people table schema
- id
- name
job table schema
- id
- people_id
- job_title
- salary
resultant table schema
- job_title (unique)
- average_salary (float, 2 dp)
- total_people (int)
- total_salary (float, 2 dp)
NOTE: Your solution should use pure SQL. Ruby is used within the test cases to do the actual testing.
SQL
Fundamentals
Similar Kata:
Stats:
Created | Oct 25, 2016 |
Published | Oct 25, 2016 |
Warriors Trained | 23295 |
Total Skips | 3308 |
Total Code Submissions | 101083 |
Total Times Completed | 9356 |
SQL Completions | 9356 |
Total Stars | 233 |
% of votes with a positive feedback rating | 78% of 1219 |
Total "Very Satisfied" Votes | 785 |
Total "Somewhat Satisfied" Votes | 336 |
Total "Not Satisfied" Votes | 98 |
Total Rank Assessments | 8 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |