Problem 2 Find all employees whose boss is either \'Alice\' or \'Ned\'. List the
ID: 3851197 • Letter: P
Question
Problem 2 Find all employees whose boss is either 'Alice' or 'Ned'. List their names, salaries, bosses' names and salaries, and the difference between the salaries (for each row). Use the column headers shown below. Employee Salary Boss Boss Salary Difference in salary Employee T $45,000.00 Alice $75,000.00 $30,000.00 $25,000.00 Ned $45,000.00 $20,000.00 Andrew $22,000.00 Ned $45,000.00 $23,000.00 Clare $75,000.00 $37,000.00 Todd $38,000.00 Alice $75,000.00 $32,000.00 Brier $43,000.00 Alice $75,000.00 $35,000.00 Alice $40,000.00 SophieExplanation / Answer
From the details you provided , the first table is the output you are expecting and the second table is the Employee table.
But there is no clear description for the Boss table or columns.
So I assumed the below Columns in Boss table.
BossNo, BossName, BossSalary. (BossNo being the primary Key)
Query:
Select Distinct
E.EmpName as Employee,
E.EmpSalary as Employee Salary,
B.BossName as Boss,
B.BossSalary as Boss Salary ,
(E.EmpSalary - B.BossSalary) as Difference in Salary
from Employee E Join Boss B On E.BossNo=B.BossNo
where B.BossName = 'Alice' or 'Ned';
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.