Guest User

Untitled

a guest
Jun 19th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. Questions
  2. Write SQL queries that provide the best answers to the following questions.
  3. 1. Who gets an hourly rate which is between (but not including) $9 and $13.50?
  4. Your query should display:
  5. J. Smith
  6. J. Red
  7. J. Brown
  8.  
  9. 2. Use the set construction operator IN to list the details of all plumbers, roofers and electricians.
  10. Your query should display:
  11. 1235 J. Smith 12.5 electrical 1311
  12. 1311 A. Orange 15.5 electrical 1311
  13. 1412 A. Green 13.75 plumbing 1520
  14. 1520 J. Red 11.75 plumbing 1520
  15. 2920 J. Brown 10 roofing 2920
  16.  
  17. 3. List the employee names and alongside their supervisor's name?
  18. Your query should display:
  19. J. Smith A. Orange
  20. A. Orange A. Orange
  21. A. Green J. Red
  22. J. Red J. Red
  23. J. Brown J. Brown
  24. A. Black A. Purple
  25. A. Purple A. Purple
  26. 4. List the employee names and alongside the supervisor's name for those people who do not self-supervise?
  27. Your query should display:
  28. J. Smith A. Orange
  29. A. Green J. Red
  30. A. Black A. Purple
  31.  
  32. 5. Which employees are assigned to work on office buildings?
  33. Your query should display:
  34. A. Black
  35. A. Green
  36. A. Purple
  37. J. Brown
  38. J. Red
  39. J. Smith
  40.  
  41. 6. Who is not assigned to work on an office building?
  42. Your query should display:
  43. A. Orange
  44.  
  45. 7. List employees who earn a higher hourly rate than their supervisors.
  46. Your query should display:
  47. A. Green
  48.  
  49. 8. What is the total number of days (hint: use SUM) allocated for plumbing work on building 312?
  50. Your query should display:
  51. 27
  52.  
  53. 9. How many different skill types are there?
  54. Your query should display:
  55. 4
  56.  
  57. 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)?
  58. Your query should display:
  59. 1311 15.5 2
  60. 1520 13.75 2
  61. 2920 10 1
  62. 3231 17.4 2
  63.  
  64. 11. For each building type, what is the average quality level?
  65. Your query should display:
  66. office 3
  67. residence 3
  68. retail 1
  69. warehouse 3
  70.  
  71. 12. For each supervisor managing more than one person, what is the highest hourly rate paid to an employee reporting to that supervisor?
  72. Your query should display:
  73. 1311 15.5
  74. 1520 13.75
  75. 3231 17.4
  76.  
  77. 13. List the building types and the number of buildings of each type.
  78. Your query should display:
  79. office 3
  80. residence 1
  81. retail 1
  82. warehouse 1
  83.  
  84. 14. Which employees receive a higher than average hourly rate?
  85. Your query should display:
  86. A. Orange
  87. A. Green
  88. A. Purple
  89.  
  90. Below is the bonus question.
  91. 15. List those employees who are assigned to work on every building. (2 marks)
  92. Your query should display:
  93. A. Green
Add Comment
Please, Sign In to add comment