User Guide
Overview
The SQLite Playground lets you run SQL queries directly in your browser without installing any software. It uses WebAssembly to run a complete SQLite database engine client-side, meaning your data never leaves your device.
This tool is ideal for testing SQL queries, learning SQL syntax, prototyping database schemas and analyzing CSV data without setting up a local database server.
When to Use This Tool
Use the SQLite Playground when:
- Testing SQL queries before running them in production
- Learning SQL syntax with instant feedback
- Prototyping database schemas and table relationships
- Analyzing CSV data with SQL queries
- Experimenting with window functions, CTEs and advanced SQL features
- Debugging SQL logic without affecting production data
- Sharing SQL examples with colleagues (paste and run)
How to Use
1. Write SQL in the Editor
Type or paste your SQL query into the textarea. The default query checks the SQLite version:
SELECT sqlite_version() AS version;2. Click Run Query
Execute your SQL and see results in a table below. Execution time is displayed to help you optimize queries.
3. Import CSV Data (Optional)
Click "Upload CSV" or paste CSV content to create an "imported" table. The first row should be column headers.
4. Explore Schema
Click any table name pill to inspect its structure with PRAGMA table_info.
5. Reset Database
Click "Reset DB" to drop all tables and start fresh.
Key Features
- Privacy-First: All processing happens in your browser via sql.js (SQLite compiled to WebAssembly). No data is sent to servers.
- CSV Import: Drag & drop CSV files or paste content. Automatic header detection and column name sanitization.
- Schema Explorer: Live table list with one-click inspection using PRAGMA commands.
- Query Execution: Real-time results with execution timing. Multi-statement support for batch operations.
- Error Feedback: Clear error messages from SQLite help you debug syntax issues quickly.
Examples
Create Table and Insert Data
CREATE TABLE users (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
email TEXT UNIQUE
);
INSERT INTO users (name, email) VALUES
('Alice', 'alice@example.com'),
('Bob', 'bob@example.com');
SELECT * FROM users;Window Function - Ranking
CREATE TABLE scores (player TEXT, score INT);
INSERT INTO scores VALUES ('Alice', 100), ('Bob', 95), ('Charlie', 100);
SELECT
player,
score,
RANK() OVER (ORDER BY score DESC) AS rank
FROM scores;CTE (Common Table Expression)
WITH sales AS (
SELECT 'Q1' AS quarter, 10000 AS revenue UNION
SELECT 'Q2', 15000 UNION
SELECT 'Q3', 12000 UNION
SELECT 'Q4', 18000
)
SELECT
quarter,
revenue,
SUM(revenue) OVER (ORDER BY quarter) AS running_total
FROM sales;Limitations and Considerations
- Memory Only: The database exists only during your browser session. Refresh the page and all data is lost.
- No Persistence: Cannot save or export the database file. Copy SQL results before closing.
- Size Limits: Browser memory limits apply. Very large datasets (100MB+) may cause performance issues.
- Single CSV Import: Each CSV import replaces the "imported" table. For multiple tables, import one CSV then create additional tables manually.
- TEXT Columns: CSV imports create TEXT columns. Use CAST() or ALTER TABLE to change types.
