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]





