Twitch is the world’s leading video platform and community for gamers, with more than 15+ million unique daily visitors. In this project, you will be working with two fictional tables that contain Twitch's streaming data and chat room data and answering questions about them:
- Streaming data is in the
stream
table - Chat usage data is in the
chat
table
Each question can be answered using one (or more) SQL queries. The answer to the first question is given. The rest is for you to figure out. Let's get started!
SELECT
all columns from the first 20 rows ofstream
table.
SELECT *
FROM stream
LIMIT 20;
-
SELECT
all columns from the first 20 rows ofchat
table. -
There is something wrong with the
chat
table. Its 1st row is actually the column names. Delete the first row of thechat
table. -
What are the
DISTINCT
game
in thestream
table? -
What are the
DISTINCT
channel
s in thestream
table? -
What are the most popular games in
stream
? Create a list of games and their number of viewers.ORDER BY
from most popular to least popular. -
There are some big numbers from the game
League of Legends
instream
. Where are theseLeague of Legend players
located?- Hint: Create a list.
-
The
player
column shows the source/device the viewer is using (site, iphone, android, etc). Create a list of players and their number of streamers. -
Using a
CASE
statement, create a new column namedgenre
for each of the games instream
. Group the games into their genres: Multiplayer Online Battle Arena (MOBA), First Person Shooter (FPS), and Others. Your logic should be: If it isLeague of Leagues
orDota 2
orHeroes of the Storm
→ then it isMOBA
. If it isCounter-Strike: Global Offensive
→ then it isFPS
. Else, it isOthers
.- Hint: Use
GROUP BY
andORDER BY
to showcase only the unique game titles.
- Hint: Use
-
The
stream
table and thechat
table share a column:device_id
. Do aJOIN
of the two tables on that column.
Bonus: Now try to find some other interesting insights from these two tables using SQL!