-
Notifications
You must be signed in to change notification settings - Fork 0
/
SQLQuery TELECOM.sql
398 lines (349 loc) · 10.4 KB
/
SQLQuery TELECOM.sql
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
Create database telecom
use telecom
select*from [dbo].[Sheet1$]
DELETE FROM [dbo].[Sheet1$]
WHERE[Area] IS NULL OR
[Shared region] is null OR
[LTE Accessibility] is null OR
[LTE Retainability] is null OR
[LTE Intra Frequency Handover] is null OR
[LTE Inter Frequency Handover] is null OR
[4G VoLTE Accessibility] is null OR
[Volte CSSR] is null OR
[Network Availability] is null OR
[time value] is null OR
[Country] is null OR
[City] is null OR
[State] is null OR
[Postal Code] is null OR
[Region] is null;
--Query to calculate the average LTE Accessibility:
SELECT
AVG([LTE Accessibility]) AS Avg_LTE_Accessibility
FROM
[dbo].[Sheet1$];
--Query to calculate the MIN LTE Accessibility:
SELECT
MIN([LTE Accessibility]) AS MIN_LTE_Accessibility
FROM
[dbo].[Sheet1$];
--Query to calculate the MAX LTE Accessibility:
SELECT
MAX([LTE Accessibility]) AS MAX_LTE_Accessibility
FROM
[dbo].[Sheet1$];
---Query to calculate the AVG LTE Retainability:
SELECT
AVG([LTE Retainability]) AS AVG_LTE_Retainability
FROM
[dbo].[Sheet1$];
---Query to calculate the MAX LTE Retainability:
SELECT
MAX([LTE Retainability]) AS MAX_LTE_Retainability
FROM
[dbo].[Sheet1$];
---Query to calculate the MIN LTE Retainability:
SELECT
MIN([LTE Retainability]) AS MIN_LTE_Retainability
FROM
[dbo].[Sheet1$];
--Query to calculate the average 4G VoLTE Accessibility:
SELECT
AVG([4G VoLTE Accessibility]) AS Avg_VoLTE_Accessibility
FROM
[dbo].[Sheet1$];
--Query to calculate the MAX 4G VoLTE Accessibility:
SELECT
MAX([4G VoLTE Accessibility]) AS MAX_VoLTE_Accessibility
FROM
[dbo].[Sheet1$];
--Query to calculate the MIN 4G VoLTE Accessibility:
SELECT
MIN([4G VoLTE Accessibility]) AS MIN_VoLTE_Accessibility
FROM
[dbo].[Sheet1$];
--Query to calculate the average Volte CSSR:
SELECT
AVG([Volte CSSR]) AS Avg_Volte_CSSR
FROM
[dbo].[Sheet1$];
----Query to calculate the MAX Volte CSSR:
SELECT
MAX([Volte CSSR]) AS MAX_Volte_CSSR
FROM
[dbo].[Sheet1$];
----Query to calculate the MIN Volte CSSR:
SELECT
MIN([Volte CSSR]) AS MIN_Volte_CSSR
FROM
[dbo].[Sheet1$];
----Query to calculate the Network Availability:
SELECT
AVG([Network Availability]) AS Network_Availability
FROM
[dbo].[Sheet1$];
----Query to calculate the LTE Intra Frequency Handover:
SELECT
AVG([LTE Intra Frequency Handover]) AS LTE_Intra_Frequency_Handover
FROM
[dbo].[Sheet1$];
----Query to calculate the LTE Inter Frequency Handover:
SELECT
AVG([LTE Inter Frequency Handover]) AS LTE_Inter_Frequency_Handover
FROM
[dbo].[Sheet1$];
---------------------------------------------------------------------------------------------------------------------------------------------------------
/*1. LTE Accessibility and LTE Retainability Analysis:
Query to calculate the average LTE Accessibility and LTE Retainability for each unique location (City and State) in the dataset:*/
SELECT
[City],
[State],
AVG([LTE Accessibility]) AS Avg_LTE_Accessibility,
AVG([LTE Retainability]) AS Avg_LTE_Retainability
FROM
[dbo].[Sheet1$]
GROUP BY
[City], [State]
ORDER BY
Avg_LTE_Accessibility DESC, Avg_LTE_Retainability DESC;
--Query to calculate the average LTE Accessibility and LTE Retainability for each unique location (City and State) in the dataset:
SELECT
[Region],
AVG([LTE Accessibility]) AS Avg_LTE_Accessibility,
AVG([LTE Retainability]) AS Avg_LTE_Retainability
FROM
[dbo].[Sheet1$]
GROUP BY
[Region]
ORDER BY
Avg_LTE_Accessibility DESC, Avg_LTE_Retainability DESC;
----Query to calculate the average LTE Accessibility and LTE Retainability for OVER TIME
SELECT
DATEPART(YEAR, [time value]) AS Year,
DATEPART(DAY, [time value]) AS day,
AVG([LTE Accessibility]) AS Avg_LTE_Accessibility,
AVG([LTE Retainability]) AS Avg_LTE_Retainability
FROM
[dbo].[Sheet1$]
GROUP BY
DATEPART(YEAR, [time value]), DATEPART(DAY,[time value])
ORDER BY
Avg_LTE_Accessibility DESC, Avg_LTE_Retainability DESC,Year, DAY;
---LTE Intra Frequency Handover AND LTE Inter Frequency Handover ANALYSIS
---Query to calculate the average LTE Intra Frequency Handover over time:
SELECT
DATEPART(YEAR, [time value]) AS Year,
DATEPART(MONTH, [time value]) AS Month,
AVG([LTE Intra Frequency Handover]) AS Avg_LTE_Intra_Handover
FROM
[dbo].[Sheet1$]
GROUP BY
DATEPART(YEAR, [time value]), DATEPART(MONTH, [time value])
ORDER BY
Year, Month;
--- by day
SELECT
DATEPART(YEAR, [time value]) AS Year,
DATEPART(DAY, [time value]) AS day,
AVG([LTE Intra Frequency Handover]) AS Avg_LTE_Intra_Handover
FROM
[dbo].[Sheet1$]
GROUP BY
DATEPART(YEAR, [time value]), DATEPART(DAY,[time value])
ORDER BY
Year, DAY;
--Query to calculate the standard deviation of LTE Inter Frequency Handover over time:
SELECT
DATEPART(YEAR, [time value]) AS Year,
DATEPART(MONTH, [time value]) AS Month,
AVG([LTE Inter Frequency Handover]) AS Avg_LTE_Intra_Handover
FROM
[dbo].[Sheet1$]
GROUP BY
DATEPART(YEAR, [time value]), DATEPART(MONTH, [time value])
ORDER BY
Year, Month;
SELECT
DATEPART(YEAR, [time value]) AS Year,
DATEPART(DAY, [time value]) AS day,
AVG([LTE Inter Frequency Handover]) AS Avg_LTE_Intra_Handover
FROM
[dbo].[Sheet1$]
GROUP BY
DATEPART(YEAR, [time value]), DATEPART(DAY,[time value])
ORDER BY
Year, DAY;
-----Query to calculate the average LTE Intra Frequency Handover and LTE Inter Frequency Handover for each REGION
SELECT
[Region],
SUM([LTE Intra Frequency Handover]) AS LTE_Intra_Frequency_Handover,
SUM([LTE Inter Frequency Handover]) AS LTE_Inter_Frequency_Handover
FROM
[dbo].[Sheet1$]
GROUP BY
[Region]
ORDER BY
LTE_Intra_Frequency_Handover DESC, LTE_Inter_Frequency_Handover DESC;
---------------------------------------------------------------------------------------------------------------------------------------------------------/*1. The State with the Best Network Availability:
--- BEST AND LEAST PERFORMANCE ANALYSIS
---Query to identify the state with the highest network availability:*/
SELECT top 1
[State],
avg([Network Availability]) AS Avg_Network_Availability
FROM
[dbo].[Sheet1$]
GROUP BY
[State]
ORDER BY
Avg_Network_Availability desc
--- for least network
SELECT top 1
[State],
avg([Network Availability]) AS Avg_Network_Availability
FROM
[dbo].[Sheet1$]
GROUP BY
[State]
ORDER BY
Avg_Network_Availability asc
/*2. The State with the Best LTE Accessibility:
Query to identify the state with the highest LTE accessibility:*/
SELECT top 1
[State],
avg([LTE Accessibility]) AS Avg_LTE_accessibility
FROM
[dbo].[Sheet1$]
GROUP BY
[State]
ORDER BY
Avg_LTE_accessibility desc
----FOR LEAST
SELECT top 1
[State],
avg([LTE Accessibility]) AS Avg_LTE_accessibility
FROM
[dbo].[Sheet1$]
GROUP BY
[State]
ORDER BY
Avg_LTE_accessibility ASC
/*3. The State with the Best LTE Retainability:
Query to identify the state with the highest LTE retainability:*/
SELECT top 1
[State],
avg([LTE Retainability]) AS Avg_LTE_retainability
FROM
[dbo].[Sheet1$]
GROUP BY
[State]
ORDER BY
Avg_LTE_retainability desc
-- FOR LEAST
SELECT top 1
[State],
avg([LTE Retainability]) AS Avg_LTE_retainability
FROM
[dbo].[Sheet1$]
GROUP BY
[State]
ORDER BY
Avg_LTE_retainability ASC
/*4. The State with the Best 4G VoLTE Accessibility:
Query to identify the state with the highest 4G VoLTE accessibility:*/
SELECT top 1
[State],
avg([4G VoLTE Accessibility]) AS Avg_4G_VoLTE_accessibility
FROM
[dbo].[Sheet1$]
GROUP BY
[State]
ORDER BY
Avg_4G_VoLTE_accessibility desc
-- FOR LEAST
SELECT top 1
[State],
avg([4G VoLTE Accessibility]) AS Avg_4G_VoLTE_accessibility
FROM
[dbo].[Sheet1$]
GROUP BY
[State]
ORDER BY
Avg_4G_VoLTE_accessibility ASC
/*5. The State with the Best VoLTE CSSR:
Query to identify the state with the highest VoLTE CSSR:*/
SELECT top 1
[State],
avg([Volte CSSR]) AS Avg_VoLTE_CSSR
FROM
[dbo].[Sheet1$]
GROUP BY
[State]
ORDER BY
Avg_VoLTE_CSSR desc
-- FOR LEAST
SELECT top 1
[State],
avg([Volte CSSR]) AS Avg_VoLTE_CSSR
FROM
[dbo].[Sheet1$]
GROUP BY
[State]
ORDER BY
Avg_VoLTE_CSSR ASC
------------------------------------------------------------------------------------------------------------------------
----4G VoLTE Accessibility and Volte CSSR ANALYSIS
----Query to calculate the average 4G VoLTE Accessibility and Volte CSSR for each REGION
SELECT
[Region],
AVG([4G VoLTE Accessibility]) AS "4G_VoLTE_Accessibility",
AVG([Volte CSSR]) AS Volte_CSSR_Retainability
FROM
[dbo].[Sheet1$]
GROUP BY
[Region]
ORDER BY
"4G_VoLTE_Accessibility" DESC, Volte_CSSR_Retainability DESC;
-------Query to calculate the average LTE Accessibility and LTE Retainability for OVER TIME
SELECT
DATEPART(YEAR, [time value]) AS Year,
DATEPART(DAY, [time value]) AS day,
AVG([4G VoLTE Accessibility]) AS "4G_VoLTE_Accessibility",
AVG([Volte CSSR]) AS Volte_CSSR_Retainability
FROM
[dbo].[Sheet1$]
GROUP BY
DATEPART(YEAR, [time value]), DATEPART(DAY,[time value])
ORDER BY
"4G_VoLTE_Accessibility" DESC, Volte_CSSR_Retainability DESC,Year, DAY;
-----NETWORK AVAILABILTY
-------Query to calculate the average Network Availability for each State
SELECT
[State],
AVG([Network Availability]) AS Avg_Network_Availability
FROM
[dbo].[Sheet1$]
GROUP BY
[State]
ORDER BY
Avg_Network_Availability DESC;
-------Query to calculate the average Network Availability for each REGION
SELECT
[Region] ,
AVG([Network Availability]) AS Avg_Network_Availability
FROM
[dbo].[Sheet1$]
GROUP BY
[Region]
ORDER BY
Avg_Network_Availability DESC;
-------Query to calculate the average LTE Accessibility and LTE Retainability for OVER TIME
SELECT
DATEPART(YEAR, [time value]) AS Year,
DATEPART(DAY, [time value]) AS day,
AVG([Network Availability]) AS Avg_Network_Availability
FROM
[dbo].[Sheet1$]
GROUP BY
DATEPART(YEAR, [time value]), DATEPART(DAY,[time value])
ORDER BY
Avg_Network_Availability DESC, Year, DAY;