forked from ta-data-pt-rmt/SQL-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathironhack_analysis.sql
More file actions
116 lines (92 loc) · 2.37 KB
/
ironhack_analysis.sql
File metadata and controls
116 lines (92 loc) · 2.37 KB
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
USE bootcamps;
/* Ranking for each course */
SELECT DISTINCT course
FROM all_bootcamps;
SELECT ranking, bootcamp_name FROM all_bootcamps
WHERE course = 'Data Analytics';
SELECT ranking, bootcamp_name FROM all_bootcamps
WHERE course = 'Cyber Security';
SELECT ranking, bootcamp_name FROM all_bootcamps
WHERE course = 'Coding';
SELECT ranking, bootcamp_name FROM all_bootcamps
WHERE course = 'Web Design';
/* Check the position of ironhack in the rankings for Data Analytics, Coding, Cyber Security and Web Design Bootcamps */
WITH
UniqueCourses AS (
SELECT DISTINCT course
FROM all_bootcamps
),
IronhackRanking AS (
SELECT course, ranking
FROM all_bootcamps
WHERE bootcamp_name = 'Ironhack'
)
SELECT
ac.course,
ir.ranking
FROM
UniqueCourses ac
LEFT JOIN
IronhackRanking ir
ON
ac.course = ir.course;
/* Cyber Security programs in top ranking + ironhack */
SELECT school, AVG(overallScore) AS averageScore
FROM reviews
WHERE LOWER(program) LIKE '%cyber%security%'
GROUP BY school
ORDER BY averageScore ASC;
/* Overall Score by school and program*/
SELECT school, program, ROUND(AVG(overallScore),2) AS averageScore
FROM reviews
WHERE LOWER(program) LIKE '%cyber%security%'
GROUP BY school, program
ORDER BY averageScore ASC;
/* Verified comments for ironhack after 2019 */
SELECT
COUNT(CASE WHEN name != 'Anonymous' THEN id END) AS non_anonymous_reviews
FROM
reviews
WHERE
LOWER(program) LIKE '%cyber%security%'
AND createdAt > '2019-12-31'
AND school = 'ironhack';
/* Bootcamp Locations */
SELECT
city_name,
id,
country_name,
COUNT(*) AS counts
FROM
locations
WHERE
school = 'ironhack'
GROUP BY
city_name, id, country_name;
/* Cybersecurity Badges */
SELECT
COUNT(DISTINCT name) AS total_unique_badges,
SUM(CASE WHEN school = 'ironhack' THEN 1 ELSE 0 END) AS ironhack_badges
FROM
badges;
/* Missing badges for ironhack */
SELECT DISTINCT name
FROM badges
WHERE school != 'ironhack'
AND name NOT IN (
SELECT DISTINCT name
FROM badges
WHERE school = 'ironhack'
);
/* Analyzing the prices */
SELECT
'All Schools' AS school,
COUNT(*) AS total_records,
AVG(priceMin) AS avg_priceMin,
AVG(priceMax) AS avg_priceMax,
MIN(priceMin) AS min_priceMin,
MIN(priceMax) AS min_priceMax,
MAX(priceMin) AS max_priceMin,
MAX(priceMax) AS max_priceMax
FROM
prices;