SQL Practice Labs
Write real SQL. See real results. No setup required.
10 hands on labs using SQLite in your browser. Type a query, click Run: results appear as a table instantly.
Progress is saved in your browser. No account needed.
Powered by sql.js: SQLite runs right here
No accounts. No downloads. No database server to set up. SQLite runs directly in your browser using sql.js, a full SQLite database engine compiled to WebAssembly. Type a query, click ▶ Run, and your results appear as a real table instantly. Everything stays right here on this page.
Before You Start
Some SQL experience is helpful but not required for Lab 1. Labs build progressively, each one introduces new concepts. Perfect companion to the Data Analyst course. If you’ve seen a SELECT statement before, you’re ready to begin.
Foundations: Labs 1 to 3
SELECT & FROM
Learn the two most fundamental SQL keywords. Query the students table, choose columns, and create calculated fields with aliases.
Open Lab →WHERE: Filtering Results
Filter rows with comparison operators, AND/OR/NOT, IN(), BETWEEN, LIKE wildcards, and IS NULL. Play the role of a financial aid officer.
Open Lab →ORDER BY, LIMIT & DISTINCT
Sort results ascending or descending, restrict output with LIMIT, and eliminate duplicates with DISTINCT. Build a student directory.
Open Lab →Aggregate Functions
Turn rows into insights. Aggregate across the retail database to answer business questions about orders, revenue, and inventory.
Open Lab →GROUP BY & HAVING
Group rows before aggregating, then filter groups with HAVING. Master the difference between WHERE and HAVING. Build a sales report.
Open Lab →JOINs: Combining Tables
Combine customers, orders, and products with INNER JOIN and LEFT JOIN. Learn table aliases. Find customers who never ordered.
Open Lab →Subqueries
Use subqueries in WHERE, FROM, and HAVING clauses. Write correlated subqueries. Query the company database to answer complex HR questions.
Open Lab →String & Date Functions
Use UPPER, LOWER, SUBSTR, LENGTH, INSTR, strftime, julianday, and CASE WHEN. Format employee names and calculate tenure.
Open Lab →INSERT, UPDATE, DELETE & CREATE
Create tables, insert rows, update records, and delete data safely. Build a student registration system from scratch. Each page load resets the database.
Open Lab →Capstone: Full Analysis
No fill in the blanks. Six real business questions from your manager. You write the SQL to answer them using the full company + sales database.
Open Lab →How Each Lab Works
Every lab follows the same structure so you always know what to expect.
Concept Recap
A quick review of the key SQL concepts, no new theory, just a focused reminder before you practice.
Worked Example
A complete, runnable SQL example showing the concepts in action against the lab’s database.
Guided Exercise
Starter SQL with blanks to fill in. Lower stakes, with hints to get you moving.
Independent + Challenge
Two exercises where you write the SQL from scratch. The challenge pushes further.
Mini Project
A real world scenario tying the whole lab together. Multiple queries, one goal.
Technical notes
- All labs load within 1 to 2 seconds: sql.js is compact and fast.
- Each lab preloads a relevant database schema with sample data automatically.
- Everything runs locally in your browser tab. Nothing is sent to a server.
- Works best in Chrome or Firefox. Safari is also supported.
- Your queries are NOT saved between page refreshes. Copy anything you want to keep.
- Labs 1 to 3 use the students database. Labs 4 to 6 use a retail database. Labs 7 to 10 use a company database.