Skip to content

felixkeng/query-wars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Query Wars

An interactive SQL learning game built on real Twitch chat data.

What's inside

Three tools in one app:

  • Block Game — drag SQL blocks to answer 15 questions (beginner → advanced)
  • SQL Sandbox — write and run any SELECT query against the real dataset
  • Data Explorer — Excel-style interface that shows the SQL it generates

Dataset

By default uses Vedal987's Twitch chat data (~248k messages across 7 VODs). You can use any Twitch channel — just change TWITCH_CHANNEL in config.py and run seed.py with any VOD IDs from that channel.

To find VOD IDs: go to twitch.tv/[channel]/videos, click any VOD, and copy the number from the URL: twitch.tv/videos/[VOD_ID]

Setup

Requirements: Python 3.12+, MySQL

# 1. Clone and install
git clone https://github.com/YOUR_USERNAME/query-wars
cd query-wars
python3.12 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

# 2. Create MySQL database
mysql -u root -e "CREATE DATABASE vedal_chat;"

# 3. Set up tables
python database.py

# 4. Seed with Twitch VOD chat (edit VODS list in seed.py first)
python seed.py

# 5. Run
python main.py

Then open http://localhost:8003

Changing the channel

In config.py:

TWITCH_CHANNEL = "vedal987"  # change to any public channel

In seed.py, update the VODS list with VOD IDs from your chosen channel:

VODS = [
    '2779925086',  # replace with your VOD IDs
]

Any public Twitch channel works — the seed script uses Twitch's public GQL API, no authentication required.

SQL concepts covered

Question Concept
1-5 SELECT, COUNT, GROUP BY, ORDER BY, LIMIT, LENGTH()
6-10 HAVING, COUNT(DISTINCT), AVG, subqueries
11-15 CTEs (WITH), RANK(), ROW_NUMBER(), PARTITION BY, window functions

Stack

Python 3.12 · FastAPI · MySQL · Vanilla JS

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages