Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Questions
- Write SQL queries that provide the best answers to the following questions.
- 1. Who gets an hourly rate which is between (but not including) $9 and $13.50?
- Your query should display:
- J. Smith
- J. Red
- J. Brown
- 2. Use the set construction operator IN to list the details of all plumbers, roofers and electricians.
- Your query should display:
- 1235 J. Smith 12.5 electrical 1311
- 1311 A. Orange 15.5 electrical 1311
- 1412 A. Green 13.75 plumbing 1520
- 1520 J. Red 11.75 plumbing 1520
- 2920 J. Brown 10 roofing 2920
- 3. List the employee names and alongside their supervisor's name?
- Your query should display:
- J. Smith A. Orange
- A. Orange A. Orange
- A. Green J. Red
- J. Red J. Red
- J. Brown J. Brown
- A. Black A. Purple
- A. Purple A. Purple
- 4. List the employee names and alongside the supervisor's name for those people who do not self-supervise?
- Your query should display:
- J. Smith A. Orange
- A. Green J. Red
- A. Black A. Purple
- 5. Which employees are assigned to work on office buildings?
- Your query should display:
- A. Black
- A. Green
- A. Purple
- J. Brown
- J. Red
- J. Smith
- 6. Who is not assigned to work on an office building?
- Your query should display:
- A. Orange
- 7. List employees who earn a higher hourly rate than their supervisors.
- Your query should display:
- A. Green
- 8. What is the total number of days (hint: use SUM) allocated for plumbing work on building 312?
- Your query should display:
- 27
- 9. How many different skill types are there?
- Your query should display:
- 4
- 10. For each supervisor, what is the highest hourly rate paid to an employee reporting to that supervisor (also show the number of employees for each supervisor)?
- Your query should display:
- 1311 15.5 2
- 1520 13.75 2
- 2920 10 1
- 3231 17.4 2
- 11. For each building type, what is the average quality level?
- Your query should display:
- office 3
- residence 3
- retail 1
- warehouse 3
- 12. For each supervisor managing more than one person, what is the highest hourly rate paid to an employee reporting to that supervisor?
- Your query should display:
- 1311 15.5
- 1520 13.75
- 3231 17.4
- 13. List the building types and the number of buildings of each type.
- Your query should display:
- office 3
- residence 1
- retail 1
- warehouse 1
- 14. Which employees receive a higher than average hourly rate?
- Your query should display:
- A. Orange
- A. Green
- A. Purple
- Below is the bonus question.
- 15. List those employees who are assigned to work on every building. (2 marks)
- Your query should display:
- A. Green
Add Comment
Please, Sign In to add comment