SQLGym is an interactive SQL challenge platform designed to help users practice SQL using realistic, fintech-style datasets — all in a clean local-first setup.
Built with a Python + FastAPI backend and a React + Tailwind frontend, SQLGym evaluates SQL queries safely and gives instant feedback using mock financial data (users, transactions, refunds, subscriptions).
- 🧠 15 realistic SQL challenges (from
BASICtoHARD) - 🔐 Secure backend with safe SQL evaluation (no DDL/DML)
- 🧾 Realistic mock financial datasets generated with
Faker - 💡 Frontend with challenge prompts, schema previews, and Monaco-based SQL editor
- ✅ Query correctness feedback with result previews
- ⚡ Local SQLite support for rapid development
// ...existing code...
| Home Page | Filtered View |
|---|---|
![]() |
![]() |
| Challenge Page | Correct Solution |
|---|---|
![]() |
![]() |
| Incorrect Solution | SQL Injection Protection |
|---|---|
![]() |
![]() |
git clone https://github.com/tsembp/SQL-Gym.git
cd SQL-Gym
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txtpython backend/db/db_seeder.pycd backend
uvicorn main:app --reloadcd frontend/tailwindcss4
npm install
npm run devsqlgym/
├── backend/
│ ├── main.py # FastAPI app
│ ├── challenge_definitions # Challenges JSON
│ ├── db/
│ │ ├── db_seeder.py # SQLite + Faker mock data
│ │ ├── models.py # SQLAlchemy models
| | └── sqlgym.db # Generated DB (gitignored)
├── frontend/
│ └── src/
│ ├── pages/
│ ├── api/
| ...
- Backend: Python, FastAPI, SQLAlchemy, SQLite
- Frontend: React, TypeScript, Tailwind CSS, Vite
- Editor: Monaco Editor
- Data: Faker, Pandas
- 🤖 GPT-powered SQL hints
- 💬 AI assistant for each challenge
- 📊 Leaderboard or progress tracking
MIT License © 2025 [Panagiotis Tsembekis]





