SQLBook.io is a free online SQL practice platform that lets you write and execute SQL queries on real database systems including PostgreSQL, MySQL, MariaDB, and Oracle—all directly in your browser with no installation required.
Visit SQLBook.io and you'll immediately see the SQL editor interface. No sign-up is required to start practicing!
The interface is divided into three main sections:
Left Panel - SQL Editor:
Right Panel - SQL Output:
Top Navigation:
Click the database dropdown in the top-left corner (default is PostgreSQL 17). Choose from:
In the SQL editor, type your query. For example:
CREATE TABLE cereal (
id serial not null primary key,
name varchar(64),
mfr varchar(64),
type varchar(64),
calories decimal,
protein decimal,
fat decimal,
sodium decimal,
fiber decimal,
carbo decimal,
sugars decimal,
potass decimal,
vitamins decimal,
shelf decimal,
weight decimal,
cups decimal,
rating decimal
);
Click the blue "Run" button in the top-right corner of the editor. Your query will execute and results will appear in the SQL Output panel.
The output panel shows:
You can write multiple SQL statements in the editor. SQLBook.io will execute them in order:
-- Drop table if it exists
DROP TABLE IF EXISTS cereal CASCADE;
-- Create the table
CREATE TABLE cereal (
id serial not null primary key,
name varchar(64),
mfr varchar(64),
type varchar(64),
calories decimal,
protein decimal,
fat decimal
);
-- Insert data
INSERT INTO cereal (name, mfr, type, calories, protein, fat)
VALUES ('100% Bran', 'N', 'C', 70, 4, 1);
INSERT INTO cereal (name, mfr, type, calories, protein, fat)
VALUES ('100% Natural Bran', 'Q', 'C', 120, 3, 5);
-- Query the data
SELECT * FROM cereal;
Each query shows its own result in the output panel:
SELECT * FROM (
SELECT * FROM cereal ORDER BY calories
) AS cals
ORDER BY protein DESC
LIMIT 10;
SELECT
id,
name,
calories,
protein,
ROUND(protein/calories, 2) AS protein_cal_ratio
FROM cereal
ORDER BY protein_cal_ratio DESC;
After running complex queries:
When you have query results displayed, you can export them:
Perfect for:
Start with a clean slate by dropping tables before creating them:
DROP TABLE IF EXISTS table_name CASCADE;
Choose clear, meaningful names for tables and columns:
customer_orders, total_salestbl1, data, tempUse SQL comments to document your queries:
-- This query finds high-protein cereals
SELECT name, protein
FROM cereal
WHERE protein > 5
ORDER BY protein DESC;
Click the "Clear" button in the output panel to remove old results and keep your workspace tidy.
Navigate to "CSV to SQL" in the top menu to:
Convert JSON objects into SQL INSERT statements for easy data import.
Practice your SQL skills with interactive puzzles and challenges.
Track your progress and see how you rank against other users.
✅ Start Simple: Begin with basic queries and gradually increase complexity
✅ Read Error Messages: The output panel will show helpful error messages if something goes wrong
✅ Use Different Databases: Try the same query on PostgreSQL, MySQL, and Oracle to learn syntax differences
✅ Save Your Work: Copy important queries to a text file or document—tabs don't persist between sessions
✅ Experiment Freely: It's a sandbox! You can't break anything, so feel free to try new things
✅ Check the Notes Tab: Contains quick-start instructions and usage tips
Query didn't run?
Results not showing?
Table doesn't exist?
SQLBook.io provides a fast, free, and convenient way to practice SQL without any setup. Whether you're learning SQL basics, testing complex queries, or prototyping database designs, SQLBook.io gives you a real database environment right in your browser.
Key Takeaways:
Start practicing SQL today at SQLBook.io!
Happy querying! 🎯