-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathModule2_Practice_Quiz
265 lines (203 loc) · 5.23 KB
/
Module2_Practice_Quiz
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
#1.
For all the questions in this practice set, you will be using the Salary by Job Range Table. This is a single table titled: salary_range_by_job_classification. This table contains the following columns:
SetID
Job_Code
Eff_Date Sal_End_Date
Salary_setID
Sal_Plan
Grade
Step
Biweekly_High_Rate
Biweekly_Low_Rate
Union_Code
Extended_Step
Pay_Type
Please refer to this information to write queries to answer the questions. Are you ready to get started?
Yes, I am ready to begin.
#2.
Find the distinct values for the extended step. The code has been started for you, but you will need to program the third line yourself before running the query.
SQL Query:
SELECT
DISTINCT Extended_step
FROM salary_range_by_job_classification
SQL Output:
+---------------+
| Extended_Step |
+---------------+
| 0 |
| 11 |
| 6 |
| 2 |
+---------------+
5 is not a distinct value in Extended_Step
#3.
Excluding $0.00, what is the minimum bi-weekly high rate of pay
(please include the dollar sign and decimal point in your answer)?
The code has been started for you, but you will need to add onto the last line of code to get the correct answer.
SQL Query:
Select
min(Biweekly_high_Rate)
From salary_range_by_job_classification
WHERE Biweekly_high_Rate <> '$0.00'
SQL Output:
+-------------------------+
| min(Biweekly_high_Rate) |
+-------------------------+
| $100.00 |
+-------------------------+
$100.00
#4.
What is the maximum biweekly high rate of pay
(please include the dollar sign and decimal point in your answer)?
The code has been started for you,
but you will need to add onto the last line of code to get the correct answer.
SQL Query:
SELECT
Max(Biweekly_high_Rate)
FROM salary_range_by_job_classification
SQL Output:
+-------------------------+
| Max(Biweekly_high_Rate) |
+-------------------------+
| $9726.38 |
+-------------------------+
$9726.38
#5.
What is the pay type for all the job codes that start with '03'?
The code has been started for you,
but you will need to program the fourth and fifth lines yourself
before running the query.
SQL Query:
Select
job_code,
pay_type
FROM salary_range_by_job_classification
WHERE job_code LIKE '03%'
SQL Output:
+----------+----------+
| Job_Code | Pay_Type |
+----------+----------+
| 0380 | B |
| 0381 | B |
| 0382 | B |
| 0390 | B |
| 0395 | B |
| 0380 | B |
| 0381 | B |
| 0382 | B |
+----------+----------+
B
#6.
Run a query to find the Effective Date (eff_date) or Salary End Date (sal_end_date) for grade Q90H0?
The code has been started for you,
but you will need to program the third through the sixth lines yourself
before running the query.
SQL Query:
Select
grade
, eff_date
, sal_end_date
FROM
salary_range_by_job_classification
WHERE grade='Q90H0'
SQL Output:
+-------+------------------------+------------------------+
| Grade | Eff_Date | Sal_End_Date |
+-------+------------------------+------------------------+
| Q90H0 | 12/26/2009 12:00:00 AM | 06/30/2010 12:00:00 AM |
+-------+------------------------+------------------------+
06/30/2010
#7.
#8.
Write and run a query, with no starter code to answer this question:
What Step are Job Codes 0110-0400? Hint: there are 6 lines to run this query.
SQL Query:
SELECT Step
FROM salary_range_by_job_classification
WHERE Job_Code BETWEEN '0110' AND '0400'
SQL Output:
+------+
| Step |
+------+
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
| 1 |
+------+
1
#9.
Write and run a query, with no starter code or hints to answer this question:
What is the Biweekly High Rate minus the Biweekly Low Rate for job Code 0170?
SQL Query:
SELECT (Biweekly_High_Rate-Biweekly_Low_Rate) AS Diff
FROM salary_range_by_job_classification
WHERE Job_Code = '0170'
SQL Output:
+------+
| Diff |
+------+
| 0 |
+------+
0
#10.
Write and run a query, with no starter code or hints to answer this question:
What is the Extended Step for Pay Types M, H, and D?
SQL Query:
SELECT Extended_Step
FROM salary_range_by_job_classification
WHERE Pay_Type IN ('M','H', 'D')
SQL Output:
重置
+---------------+
| Extended_Step |
+---------------+
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
+---------------+
0
#11.
Write and run a query, with no starter code or hints to answer this question:
What is the step for Union Code 990 and a Set ID of SFMTA or COMMN?
SQL Query:
SELECT Step
FROM salary_range_by_job_classification
WHERE Union_Code='990' AND (SetID='SFMTA' OR SetID='COMMN')
SQL Output:
+------+
| Step |
+------+
| 1 |
+------+