-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new subdirectory inside Database Design Directory
- Loading branch information
1 parent
e6dfc26
commit d4bc648
Showing
12 changed files
with
3,482 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
157 changes: 157 additions & 0 deletions
157
...e, and User Role, and Privileges of Video Game Reviews Kaggle Dataset for OLTP System.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
-- Non-Materialized Views for OLTP System (Kaggle Dataset) | ||
|
||
|
||
-- Drop view if exists | ||
DROP VIEW IF EXISTS | ||
cheapest_games_per_platforms; | ||
DROP VIEW IF EXISTS | ||
game_descriptions; | ||
|
||
|
||
|
||
-- Cheapest games per platforms | ||
CREATE VIEW | ||
cheapest_games_per_platforms AS | ||
WITH | ||
cheapest_prices_per_platforms AS ( | ||
SELECT | ||
kaggle_db.platforms.`Platform`, | ||
MIN(kaggle_db.video_game_reviews.`Price`) AS price | ||
FROM | ||
kaggle_db.video_game_reviews | ||
INNER JOIN | ||
kaggle_db.platforms | ||
USING(platform_id) | ||
GROUP BY | ||
kaggle_db.platforms.`Platform` | ||
ORDER BY | ||
price | ||
) | ||
|
||
SELECT | ||
`Game Title`, | ||
cheapest_prices_per_platforms.`Platform`, | ||
cheapest_prices_per_platforms.price | ||
FROM | ||
cheapest_prices_per_platforms | ||
INNER JOIN | ||
kaggle_db.video_game_reviews | ||
ON | ||
cheapest_prices_per_platforms.price = kaggle_db.video_game_reviews.`Price` | ||
ORDER BY | ||
cheapest_prices_per_platforms.price; | ||
|
||
|
||
-- Game Descriptions | ||
CREATE VIEW | ||
game_descriptions AS | ||
SELECT | ||
`Game Title`, | ||
`User Rating`, | ||
`Price`, | ||
`Platform`, | ||
`Release Year`, | ||
`Genre`, | ||
`User Review Text`, | ||
`Game Mode` | ||
FROM | ||
kaggle_db.video_game_reviews | ||
INNER JOIN | ||
kaggle_db.platforms | ||
USING(platform_id) | ||
INNER JOIN | ||
kaggle_db.release_years | ||
USING(release_year_id) | ||
INNER JOIN | ||
kaggle_db.genres | ||
USING(genre_id) | ||
INNER JOIN | ||
kaggle_db.game_modes | ||
USING(game_mode_id) | ||
ORDER BY | ||
`User Rating` DESC; | ||
|
||
|
||
|
||
-- Creating roles and privileges for OLTP System (Kaggle Dataset) | ||
|
||
|
||
-- Drop role/s or user accounts if exists | ||
DROP ROLE IF EXISTS | ||
users; | ||
DROP USER IF EXISTS | ||
'joe'@'localhost'; | ||
DROP ROLE IF EXISTS | ||
data_scientists; | ||
DROP USER IF EXISTS | ||
'willie'@'localhost'; | ||
DROP ROLE IF EXISTS | ||
data_admins; | ||
DROP USER IF EXISTS | ||
'christiane'@'localhost'; | ||
|
||
|
||
|
||
-- User/Group Roles | ||
CREATE ROLE | ||
users; | ||
CREATE USER | ||
'joe'@'localhost'; | ||
CREATE ROLE | ||
data_scientists; | ||
CREATE USER | ||
'willie'@'localhost'; | ||
CREATE ROLE | ||
data_admins; | ||
CREATE USER | ||
'christiane'@'localhost'; | ||
|
||
|
||
-- Grant 'SELECT' Privileges of 'game_descriptions' view for 'users', and 'data_scientists' role | ||
GRANT SELECT | ||
ON | ||
game_descriptions | ||
TO | ||
users, data_scientists; | ||
|
||
|
||
-- Grant 'SELECT' Privileges of 'cheapest_games_per_platforms' view for 'users', and 'data_scientist' role | ||
GRANT SELECT | ||
ON | ||
cheapest_games_per_platforms | ||
TO | ||
users, data_scientists; | ||
|
||
|
||
-- Grant 'CREATE, SELECT, UPDATE, DELETE' Privileges of 'video_game_reviews' table from 'kaggle_db' database for 'data_admins' role | ||
GRANT CREATE, SELECT, UPDATE, DELETE | ||
ON | ||
kaggle_db.video_game_reviews | ||
TO | ||
data_admins; | ||
|
||
|
||
|
||
-- Grant 'users' role privileges to 'joe' user account | ||
GRANT users | ||
TO | ||
'joe'@'localhost'; | ||
|
||
|
||
-- Grant 'data_scientists' role to 'willie' user account | ||
GRANT data_scientists | ||
TO | ||
'willie'@'localhost'; | ||
|
||
|
||
-- Grant 'data_admin' role to 'christiane' user account | ||
GRANT data_admins | ||
TO | ||
'christiane'@'localhost'; | ||
|
||
|
||
|
||
-- Show privileges | ||
SHOW GRANTS FOR 'joe'@'localhost'; | ||
SHOW GRANTS FOR 'willie'@'localhost'; | ||
SHOW GRANTS FOR 'christiane'@'localhost'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
age_group_id,"Age Group Targeted" | ||
1,"All Ages" | ||
2,Adults | ||
3,Teens | ||
4,Kids |
91 changes: 91 additions & 0 deletions
91
Database Design/Video Game Reviews/developers_and_publishers.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
developer_publisher_id,Developer,Publisher | ||
1,"Game Freak",Innersloth | ||
2,Nintendo,"Electronic Arts" | ||
3,Bungie,Capcom | ||
4,"Game Freak",Nintendo | ||
5,"Game Freak","Epic Games" | ||
6,Capcom,Capcom | ||
7,Capcom,"Take-Two Interactive" | ||
8,"Epic Games","Epic Games" | ||
9,"CD Projekt Red",Innersloth | ||
10,Capcom,Activision | ||
11,Capcom,"Epic Games" | ||
12,"EA Sports",Activision | ||
13,"Epic Games",Valve | ||
14,"Epic Games",Activision | ||
15,Bungie,"Take-Two Interactive" | ||
16,Bungie,"Epic Games" | ||
17,Nintendo,Innersloth | ||
18,"Game Freak",Capcom | ||
19,Capcom,"Electronic Arts" | ||
20,Bungie,"Electronic Arts" | ||
21,"Rockstar Games","Epic Games" | ||
22,Capcom,Valve | ||
23,Innersloth,Innersloth | ||
24,"EA Sports",Nintendo | ||
25,"Epic Games","Take-Two Interactive" | ||
26,"Rockstar Games",Valve | ||
27,Bungie,Valve | ||
28,Valve,Nintendo | ||
29,"Game Freak",Activision | ||
30,Valve,"Epic Games" | ||
31,Bungie,"Square Enix" | ||
32,"EA Sports",Innersloth | ||
33,"Epic Games",Innersloth | ||
34,"Game Freak","Take-Two Interactive" | ||
35,"Rockstar Games","Take-Two Interactive" | ||
36,"CD Projekt Red",Activision | ||
37,Innersloth,"Square Enix" | ||
38,Nintendo,Valve | ||
39,"Epic Games","Electronic Arts" | ||
40,Bungie,Nintendo | ||
41,Nintendo,"Square Enix" | ||
42,Innersloth,Activision | ||
43,"Game Freak",Valve | ||
44,"EA Sports","Electronic Arts" | ||
45,"CD Projekt Red",Nintendo | ||
46,Innersloth,Capcom | ||
47,"EA Sports","Square Enix" | ||
48,"Rockstar Games","Square Enix" | ||
49,"Epic Games","Square Enix" | ||
50,"EA Sports",Capcom | ||
51,Nintendo,Nintendo | ||
52,Valve,"Square Enix" | ||
53,"CD Projekt Red","Epic Games" | ||
54,"Rockstar Games",Capcom | ||
55,"EA Sports","Epic Games" | ||
56,Valve,"Electronic Arts" | ||
57,Innersloth,"Electronic Arts" | ||
58,"EA Sports",Valve | ||
59,"CD Projekt Red","Electronic Arts" | ||
60,"Epic Games",Capcom | ||
61,Innersloth,Valve | ||
62,Nintendo,"Take-Two Interactive" | ||
63,Capcom,"Square Enix" | ||
64,Valve,Innersloth | ||
65,Nintendo,Capcom | ||
66,Innersloth,Nintendo | ||
67,Bungie,Activision | ||
68,"Game Freak","Square Enix" | ||
69,"Rockstar Games","Electronic Arts" | ||
70,Capcom,Nintendo | ||
71,Valve,"Take-Two Interactive" | ||
72,"Game Freak","Electronic Arts" | ||
73,Nintendo,"Epic Games" | ||
74,Valve,Valve | ||
75,Capcom,Innersloth | ||
76,"Rockstar Games",Nintendo | ||
77,"CD Projekt Red",Valve | ||
78,Bungie,Innersloth | ||
79,Innersloth,"Take-Two Interactive" | ||
80,"CD Projekt Red","Square Enix" | ||
81,"Rockstar Games",Innersloth | ||
82,"CD Projekt Red","Take-Two Interactive" | ||
83,Innersloth,"Epic Games" | ||
84,"Rockstar Games",Activision | ||
85,Valve,Capcom | ||
86,"Epic Games",Nintendo | ||
87,"CD Projekt Red",Capcom | ||
88,Nintendo,Activision | ||
89,Valve,Activision | ||
90,"EA Sports","Take-Two Interactive" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
game_mode_id,"Game Mode" | ||
1,Offline | ||
2,Online |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
game_quality_id,"Graphics Quality","Soundtrack Quality","Story Quality" | ||
1,Medium,Average,Poor | ||
2,Low,Poor,Poor | ||
3,Low,Good,Average | ||
4,Medium,Good,Excellent | ||
5,High,Poor,Good | ||
6,Low,Average,Poor | ||
7,High,Excellent,Good | ||
8,Ultra,Poor,Poor | ||
9,Low,Average,Good | ||
10,Medium,Excellent,Good | ||
11,Medium,Average,Average | ||
12,Ultra,Average,Poor | ||
13,Ultra,Poor,Excellent | ||
14,Medium,Excellent,Excellent | ||
15,Medium,Good,Poor | ||
16,Ultra,Poor,Average | ||
17,High,Poor,Average | ||
18,High,Excellent,Excellent | ||
19,Medium,Good,Average | ||
20,Ultra,Average,Excellent | ||
21,Low,Good,Good | ||
22,High,Poor,Poor | ||
23,High,Average,Good | ||
24,Low,Poor,Excellent | ||
25,Ultra,Excellent,Good | ||
26,High,Good,Average | ||
27,High,Good,Poor | ||
28,Low,Average,Average | ||
29,Medium,Poor,Excellent | ||
30,Low,Poor,Good | ||
31,Ultra,Excellent,Average | ||
32,High,Excellent,Average | ||
33,High,Poor,Excellent | ||
34,Ultra,Average,Good | ||
35,Low,Average,Excellent | ||
36,Medium,Average,Good | ||
37,Ultra,Good,Average | ||
38,Medium,Average,Excellent | ||
39,Ultra,Good,Excellent | ||
40,High,Good,Excellent | ||
41,High,Average,Poor | ||
42,Medium,Poor,Poor | ||
43,Low,Excellent,Poor | ||
44,Low,Excellent,Good | ||
45,Low,Poor,Average | ||
46,Medium,Good,Good | ||
47,Low,Good,Poor | ||
48,Low,Excellent,Average | ||
49,Medium,Poor,Average | ||
50,Medium,Poor,Good | ||
51,Low,Excellent,Excellent | ||
52,High,Average,Excellent | ||
53,High,Excellent,Poor | ||
54,High,Average,Average | ||
55,Medium,Excellent,Average | ||
56,Ultra,Poor,Good | ||
57,Low,Good,Excellent | ||
58,Ultra,Good,Poor | ||
59,Ultra,Average,Average | ||
60,Ultra,Good,Good | ||
61,Medium,Excellent,Poor | ||
62,Ultra,Excellent,Excellent | ||
63,Ultra,Excellent,Poor | ||
64,High,Good,Good |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
genre_id,Genre | ||
1,Adventure | ||
2,Shooter | ||
3,Sports | ||
4,RPG | ||
5,Simulation | ||
6,Strategy | ||
7,Fighting | ||
8,Action | ||
9,Party | ||
10,Puzzle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
multiplayer_id,Multiplayer | ||
1,No | ||
2,Yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
platform_id,Platform | ||
1,PC | ||
2,Mobile | ||
3,PlayStation | ||
4,Xbox | ||
5,"Nintendo Switch" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
release_year_id,"Release Year" | ||
1,2015 | ||
2,2012 | ||
3,2022 | ||
4,2017 | ||
5,2020 | ||
6,2010 | ||
7,2013 | ||
8,2018 | ||
9,2011 | ||
10,2014 | ||
11,2016 | ||
12,2023 | ||
13,2021 | ||
14,2019 |
3 changes: 3 additions & 0 deletions
3
Database Design/Video Game Reviews/requires_special_devices.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
special_device_id,"Requires Special Device" | ||
1,No | ||
2,Yes |
Oops, something went wrong.