-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetflix
More file actions
86 lines (66 loc) · 1.82 KB
/
Copy pathNetflix
File metadata and controls
86 lines (66 loc) · 1.82 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
-- Content Distribution Across countries
SELECT country, COUNT(*) AS content_count
FROM netflix
WHERE country IS NOT NULL
GROUP BY country
ORDER BY content_count DESC
LIMIT 5;
-- Most Popular Genre on Netflix
SELECT listed_in, COUNT(*) AS genre_count
FROM netflix
WHERE listed_in IS NOT NULL
GROUP BY listed_in
ORDER BY genre_count DESC
LIMIT 5;
-- Content Addition Over the Years
SELECT EXTRACT(YEAR FROM TO_DATE(date_added, 'Month DD, YYYY')) AS year_added,
COUNT(*) AS total_added
FROM netflix
WHERE date_added IS NOT NULL
GROUP BY year_added
ORDER BY year_added DESC;
-- Movies vs TV Shows Comparison
SELECT type, COUNT(*) AS count
FROM netflix
GROUP BY type;
-- Top Directors with Most Content
SELECT director, COUNT(*) AS total_content
FROM netflix
WHERE director IS NOT NULL
GROUP BY director
ORDER BY total_content DESC
LIMIT 5;
-- TOP 10 Content Availability by country & Genre
SELECT country, listed_in, COUNT(*) AS total_content
FROM netflix
WHERE country IS NOT NULL AND listed_in IS NOT NULL
GROUP BY country, listed_in
ORDER BY total_content DESC
LIMIT 10;
-- Most Recent Added Content
SELECT title, type, date_added
FROM netflix
WHERE date_added IS NOT NULL
ORDER BY date_added DESC
LIMIT 10;
-- TOP Content Duration Performance
SELECT title, type, duration
FROM netflix
WHERE duration IS NOT NULL
ORDER BY CAST(SPLIT_PART(duration, ' ', 1) AS INTEGER) DESC
LIMIT 10;
-- Country with the Highest Number of TV Shows
SELECT country, COUNT(*) AS tv_show_count
FROM netflix
WHERE type = 'TV Show' AND country IS NOT NULL
GROUP BY country
ORDER BY tv_show_count DESC
LIMIT 5;
-- Monthly Trend of Content Additions
SELECT TO_CHAR(TO_DATE(date_added, 'Month DD, YYYY'), 'YYYY-MM') AS month_added,
COUNT(*) AS total_added
FROM netflix
WHERE date_added IS NOT NULL
GROUP BY month_added
ORDER BY month_added DESC
LIMIT 10;