-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVideo Game Sales.sql
73 lines (60 loc) · 2.77 KB
/
Video Game Sales.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
-- Top 10 Best-Selling Video Games in the World
SELECT Name, Platform, Year, Genre, Publisher, Global_Sales FROM video_game_sales
ORDER BY Global_Sales DESC
LIMIT 10;
-- Top 10 Best-Selling Video Games in North America
SELECT Name, Platform, Year, Genre, Publisher, NA_Sales FROM video_game_sales
ORDER BY NA_Sales DESC
LIMIT 10;
-- Top 10 Best-Selling Video Games in Europe
SELECT Name, Platform, Year, Genre, Publisher, EU_Sales FROM video_game_sales
ORDER BY EU_Sales DESC
LIMIT 10;
-- Top 10 Best-Selling Video Games in Japan
SELECT Name, Platform, Year, Genre, Publisher, JP_Sales FROM video_game_sales
ORDER BY JP_Sales DESC
LIMIT 10;
-- Top 10 Best-Selling Video Games in Other Countries
SELECT Name, Platform, Year, Genre, Publisher, Other_Sales FROM video_game_sales
ORDER BY Other_Sales DESC
LIMIT 10;
-- Total Sales For Each Region
SELECT SUM(NA_Sales) AS Total_NA_Sales, SUM(EU_Sales) AS Total_EU_Sales, SUM(Other_Sales) AS Total_Other_Sales FROM video_game_sales;
-- Top 5 Most Popular Video Game Platform
SELECT Platform, SUM(NA_Sales) AS Total_NA_Sales, SUM(EU_Sales) AS Total_EU_Sales, SUM(Other_Sales) AS Total_Other_Sales, SUM(Global_Sales) AS Total_Global_Sales FROM video_game_sales
GROUP BY Platform
ORDER BY Total_Global_Sales DESC
LIMIT 5;
-- Top 10 Most Popular Video Game Genre
SELECT Genre, SUM(NA_Sales) AS Total_NA_Sales, SUM(EU_Sales) AS Total_EU_Sales, SUM(Other_Sales) AS Total_Other_Sales, SUM(Global_Sales) AS Total_Global_Sales FROM video_game_sales
GROUP BY Genre
ORDER BY Total_Global_Sales DESC
LIMIT 10;
-- Top 10 Most Popular Video Game Genre in North America
SELECT Genre, SUM(NA_Sales) AS Total_NA_Sales FROM video_game_sales
GROUP BY Genre
ORDER BY Total_NA_Sales DESC
LIMIT 10;
-- Top 10 Most Popular Video Game Genre in Europe
SELECT Genre, SUM(EU_Sales) AS Total_EU_Sales FROM video_game_sales
GROUP BY Genre
ORDER BY Total_EU_Sales DESC
LIMIT 10;
-- Top 10 Most Popular Video Game Genre in Japan
SELECT Genre, SUM(JP_Sales) AS Total_JP_Sales FROM video_game_sales
GROUP BY Genre
ORDER BY Total_JP_Sales DESC
LIMIT 10;
-- Top 10 Most Popular Video Game Genre in Other Countries
SELECT Genre, SUM(Other_Sales) AS Total_Other_Sales FROM video_game_sales
GROUP BY Genre
ORDER BY Total_Other_Sales DESC
LIMIT 10;
-- Total Sales by Publisher
SELECT Publisher, SUM(NA_Sales) AS Total_NA_Sales, SUM(EU_Sales) AS Total_EU_Sales, SUM(Other_Sales) AS Total_Other_Sales, SUM(Global_Sales) AS Total_Global_Sales FROM video_game_sales
GROUP BY Publisher
ORDER BY Total_Global_Sales DESC;
-- Number of Games Released and Total Sales for Each Year
SELECT Year, COUNT(Year) AS Number_Of_Games, SUM(NA_Sales) AS Total_NA_Sales, SUM(EU_Sales) AS Total_EU_Sales, SUM(Other_Sales) AS Total_Other_Sales, SUM(Global_Sales) AS Total_Global_Sales FROM video_game_sales
GROUP BY Year
ORDER BY Year;