Given the following Table EmpJob for retail stores (assume there is more data):
ID: 3714704 • Letter: G
Question
Given the following Table EmpJob for retail stores (assume there is more data):
EmpId
FirstName
LastName
SSN
DateOfBirth
Company
HQ
JobId
JobName
PayGrade
Salary
111526
Matt
Davis
552124532
08/04/1978
Hot Topic
FL
01
Associate
3
$30,000
111535
Jason
Briggs
442123124
01/24/1981
Spencers
NY
02
Manager
5
$40,000
110343
Steven
Smith
552123121
04/23/1976
Spencers
CA
01
Associate
4
$32,000
223234
John
Walker
443628123
01/24/1968
Hot Topic
CA
02
Manager
6
$45,000
Retrieve the average salary and HQ for all managers per HQ (10 pts).
EmpId
FirstName
LastName
SSN
DateOfBirth
Company
HQ
JobId
JobName
PayGrade
Salary
111526
Matt
Davis
552124532
08/04/1978
Hot Topic
FL
01
Associate
3
$30,000
111535
Jason
Briggs
442123124
01/24/1981
Spencers
NY
02
Manager
5
$40,000
110343
Steven
Smith
552123121
04/23/1976
Spencers
CA
01
Associate
4
$32,000
223234
John
Walker
443628123
01/24/1968
Hot Topic
CA
02
Manager
6
$45,000
Explanation / Answer
Please find below the query to Retrieve the average salary and HQ for all managers per HQ.
Here, In this query, we are finding all the employess with JobName as 'Managers' and then we are grouping them according to their HQ to find the average salary.
Query :
SELECT HQ,AVG(Salary)
FROM EmpJob
WHERE JobName = 'Manager'
GROUP BY HQ;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.