sql-playground

# Komal's SQL Playground **A browser-based SQL learning terminal with a student academic database.** [![Live Demo](https://img.shields.io/badge/Live-Demo-ff2e93?style=for-the-badge&logo=github)](https://komal.github.io/sql-playground) [![HTML](https://img.shields.io/badge/HTML5-Single%20File-ff7ab8?style=for-the-badge&logo=html5)](./Komal_SQL_Server.html) [![License](https://img.shields.io/badge/License-MIT-ffc1e3?style=for-the-badge)](./LICENSE) [![Made With Love](https://img.shields.io/badge/Made%20with-๐Ÿ’–-ff2e93?style=for-the-badge)](https://github.com/komal)
image > *A production-quality SQL workbench that runs entirely in the browser โ€” no backend, no setup, no dependencies to install.*

Features

Feature Description
Pink Aesthetic Theme Elegant, feminine, professional dark UI with a vibrant #ff2e93 pink palette
Dark / Light Toggle Smooth theme switching with full CSS variable system
Resizable Sidebar Drag the sidebar edge to resize like VS Code
SQL Reference Panel 9 collapsible cheat cards with clickable snippets that load directly into the editor
Live SQL Execution Write and run SELECT queries instantly โ€” no server needed
Read-Only Security Only SELECT statements are permitted โ€” safe for learning environments
50-Row Academic Dataset Rich student database across 8 departments with 10 columns
Smart Cell Coloring Status, grade, and fee columns are color-coded automatically
Keyboard Shortcut Ctrl + Enter (or Cmd + Enter) to run queries
Line Numbers Editor shows live line numbers as you type
Tab Key Support Press Tab in the editor to insert 2-space indentation

๐Ÿš€ Quick Start

Option 1 โ€” Open Directly (Zero Setup)

Download Komal_SQL_Server.html, then double-click to open in any modern browser.

That's it. No npm install. No server. No build step.

Option 2 โ€” Clone the Repository

git clone https://github.com/komalharshita/sql-playground.git
cd sql-playground
open Komal_SQL_Server.html   # macOS
# or
start Komal_SQL_Server.html  # Windows
# or
xdg-open Komal_SQL_Server.html  # Linux
  1. Fork this repository
  2. Go to Settings โ†’ Pages
  3. Set source to main branch, / (root)
  4. Your playground will be live at https://<your-username>.github.io/sql-playground

Database Reference

The playground ships with a single table: students

-- Table schema
CREATE TABLE students (
  student_id  INT,      -- Unique ID (1001โ€“1050)
  name        STRING,   -- Full student name
  department  STRING,   -- Academic department
  year        INT,      -- Year of study (1โ€“4)
  gpa         FLOAT,    -- GPA (2.1 โ€“ 4.0)
  attendance  INT,      -- Attendance percentage (48โ€“99)
  status      STRING,   -- 'Active' | 'On Probation'
  grade       STRING,   -- 'A+' | 'A' | 'B+' | 'B' | 'C' | 'D' | 'F'
  credits     INT,      -- Credits earned (12โ€“128)
  fee_status  STRING    -- 'Paid' | 'Pending' | 'Waived'
);

Departments included:

Computer Science ยท Data Science ยท Mathematics ยท Physics ยท Chemistry ยท Electronics ยท Mechanical Engg

50 records with realistic, varied data โ€” a mix of honor roll students, students on probation, scholarship recipients (fee_status = 'Waived'), and everything in between.


Example Queries to Try

-- Top 5 students by GPA
SELECT name, department, gpa
FROM students
ORDER BY gpa DESC
LIMIT 5;

-- At-risk students (low GPA AND low attendance)
SELECT name, gpa, attendance, status
FROM students
WHERE gpa < 3.0 AND attendance < 65;

-- Department summary report
SELECT department,
  COUNT(*) AS student_count,
  ROUND(AVG(gpa), 2) AS avg_gpa,
  MIN(attendance) AS lowest_att
FROM students
GROUP BY department
ORDER BY avg_gpa DESC;

-- Pending fee breakdown
SELECT name, department, year, fee_status
FROM students
WHERE fee_status = 'Pending'
ORDER BY year ASC;

-- 4th year honor students
SELECT name, grade, gpa, credits
FROM students
WHERE year = 4 AND gpa >= 3.7
ORDER BY gpa DESC;

๐Ÿ› ๏ธ Tech Stack

Technology Role
React 18 (CDN) UI component rendering
AlaSQL 1.7.3 In-browser SQL engine
Babel Standalone JSX transpilation in the browser
Font Awesome 6.5 Icons
Syne (Google Fonts) Display / UI font
Fira Code (Google Fonts) Monospace / code font
Vanilla CSS All styling via CSS custom properties

๐Ÿ“ Project Structure

sql-playground/
โ”‚
โ”œโ”€โ”€ ๐Ÿ“„ Komal_SQL_Server.html      โ† The entire application (open this!)
โ”œโ”€โ”€ ๐Ÿ“„ README.md                  โ† You are here
โ”œโ”€โ”€ ๐Ÿ“„ LICENSE                    โ† MIT License
โ”œโ”€โ”€ ๐Ÿ“„ CHANGELOG.md               โ† Version history
โ”œโ”€โ”€ ๐Ÿ“„ CONTRIBUTING.md            โ† How to contribute
โ”œโ”€โ”€ ๐Ÿ“„ CODE_OF_CONDUCT.md         โ† Community guidelines
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ docs/
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ USAGE.md               โ† Detailed usage guide
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ SQL_REFERENCE.md       โ† Full SQL syntax reference
โ”‚     
โ””โ”€โ”€ ๐Ÿ“ .github/
    โ”œโ”€โ”€ ๐Ÿ“„ PULL_REQUEST_TEMPLATE.md



Theme System

The app uses a CSS custom property system with two fully-defined themes:

/* Dark Theme (default) */
--bg:        #0a0a0f;   /* Deep black background   */
--surface:   #14141c;   /* Panel surfaces          */
--pink:      #ff2e93;   /* Primary pink accent     */
--pink-acc:  #ff7ab8;   /* Soft rose accent        */
--pink-lt:   #ffc1e3;   /* Light pink highlight    */

/* Light Theme */
--bg:        #fff5fa;   /* Warm white background   */
--pink:      #d4006b;   /* Deeper pink for contrast*/

Toggle is in the top-right navbar (โ˜€ / ๐ŸŒ™ button).


๐Ÿค Contributing

Contributions are welcome! Please read CONTRIBUTING.md before opening a pull request.

Quick ideas to contribute:


Roadmap


๐Ÿ“„ License

This project is licensed under the MIT License โ€” see LICENSE for details.


Made with ๐Ÿ’– by **[Komal Harshita](https://github.com/komalharshita)** *If this helped you learn SQL, please consider giving it a โญ*