Skip to content

ThirDecade2020/QueryTheory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

QueryTheory

QueryTheory is a web-based educational app that helps users understand how SQL queries translate into relational algebra and set theory. It provides real-time query execution, mathematical explanations, and an AI-powered chat interface for deeper learning.


๐Ÿง  Features

  • ๐Ÿ”Ž Query Templates: Practice with 50+ categorized SQL queries.
  • ๐Ÿงฎ Math Explainer: View relational algebra equivalents in LaTeX.
  • ๐Ÿ’ฌ Chat Support: Ask questions about the queryโ€™s mathematical structure.
  • ๐Ÿงช Run SQL Queries: Execute SQL directly on a built-in dataset.
  • ๐Ÿ“Š Live Results: See output tables immediately after query execution.
  • ๐Ÿ“ Preloaded Dataset: Work with Fruit-Prices-2022.csv by default.
  • ๐Ÿ—ƒ๏ธ Theory-Driven: Designed around core relational concepts.

๐Ÿงฐ Tech Stack

  • Frontend: Streamlit
  • Backend: Python (OpenAI API, DuckDB)
  • Data Storage: CSV (local), JSON state
  • Configuration: Python scripts, Streamlit secrets

๐Ÿ“‚ Project Structure

QueryTheory/
โ”‚
โ”œโ”€โ”€ app.py               # Main Streamlit application
โ”œโ”€โ”€ app_state.json       # Stores query templates & chat history
โ”œโ”€โ”€ Fruit-Prices-2022.csv # Demo dataset for SQL queries
โ”œโ”€โ”€ venv/                # Python virtual environment
โ””โ”€โ”€ README.md            # Project documentation (this file)

โ–ถ๏ธ Running the App

Make sure your virtual environment is activated and required dependencies are installed.

source venv/bin/activate
streamlit run app.py

๐Ÿ” Configuration

Store your OpenAI API key securely in .streamlit/secrets.toml:

[openai]
api_key = "your_openai_key"

๐Ÿ‘จโ€๐Ÿซ Use Cases

  • CS students learning database theory
  • Bootcamp participants practicing SQL
  • Instructors creating theory-backed demos
  • Anyone exploring how SQL maps to mathematical logic

๐Ÿ“ธ Preview

App Screenshot


๐Ÿ› ๏ธ Development

To contribute or test features:

git clone https://github.com/ThirDecade2020/QueryTheory.git
cd QueryTheory
source venv/bin/activate
streamlit run app.py

๐Ÿ“œ License

MIT License ยฉ 2025 Jason Ricciardi

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages