How to Use SQLBook.io: Complete Beginner's Guide

What is SQLBook.io?

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.


Getting Started

1. Access the Platform

Visit SQLBook.io and you'll immediately see the SQL editor interface. No sign-up is required to start practicing!

2. Understanding the Interface

The interface is divided into three main sections:

Left Panel - SQL Editor:

  • Write and edit your SQL queries here
  • Features syntax highlighting for easy reading
  • Line numbers for reference
  • Supports multiple tabs for different queries

Right Panel - SQL Output:

  • Displays query results in formatted tables
  • Shows update counts for INSERT, UPDATE, DELETE operations
  • Provides success/error messages
  • Includes options to copy results as CSV or Markdown

Top Navigation:

  • Database Selector: Choose your database (PostgreSQL, MySQL, MariaDB, Oracle)
  • Tabs: Switch between Notes and SQL editor tabs
  • Run Button: Execute your SQL code
  • Additional Tools: CSV to SQL, JSON to SQL, Puzzles, Scores, Feedback

Step-by-Step: Your First Query

Step 1: Select Your Database

Click the database dropdown in the top-left corner (default is PostgreSQL 17). Choose from:

  • PostgreSQL (various versions)
  • MySQL
  • MariaDB
  • Oracle

Step 2: Write Your SQL Code

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
);

Step 3: Execute the Query

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.

Step 4: Review the Results

The output panel shows:

  • Query text: The SQL that was executed
  • Update Count: Number of rows affected (for INSERT, UPDATE, DELETE)
  • Result Table: Data returned (for SELECT queries)
  • Success notification: Green popup confirms successful execution

Working with Multiple Queries

Running Multiple Statements

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;

Understanding Query Results

Each query shows its own result in the output panel:

  • SQL-1, SQL-2, etc.: Numbered results for each statement
  • Results appear in reverse chronological order (newest at top)
  • Click "Clear" to remove old results

Advanced Queries

Using Subqueries

SELECT * FROM (
    SELECT * FROM cereal ORDER BY calories
) AS cals 
ORDER BY protein DESC 
LIMIT 10;

Calculating Values

SELECT 
    id, 
    name, 
    calories, 
    protein, 
    ROUND(protein/calories, 2) AS protein_cal_ratio
FROM cereal 
ORDER BY protein_cal_ratio DESC;

Viewing Results

After running complex queries:

  1. Results display in a formatted table
  2. Column headers match your SELECT statement
  3. Data is properly aligned and easy to read
  4. Row count appears at the bottom

Using Multiple Tabs

Creating New Tabs

  1. Click the "+" button next to the "Notes" and "SQL" tabs
  2. Name your new tab for different projects or exercises
  3. Each tab maintains its own SQL code independently

Tab Uses

  • Notes Tab: Read-only documentation and usage instructions
  • SQL Tabs: Multiple workspaces for different queries
  • Great for comparing different approaches or keeping reference queries

Exporting Results

When you have query results displayed, you can export them:

  1. Copy as CSV: Click the "Copy CSV" button to copy results in comma-separated format
  2. Copy as Markdown: Click "Copy Markdown" to get a markdown-formatted table

Perfect for:

  • Sharing results with colleagues
  • Documenting your work
  • Creating reports or tutorials

Best Practices

1. Clean Up Your Database

Start with a clean slate by dropping tables before creating them:

DROP TABLE IF EXISTS table_name CASCADE;

2. Use Descriptive Names

Choose clear, meaningful names for tables and columns:

  • ✅ Good: customer_orders, total_sales
  • ❌ Avoid: tbl1, data, temp

3. Test Incrementally

  • Write one query at a time
  • Test it before moving to the next
  • Build complexity gradually

4. Comment Your Code

Use SQL comments to document your queries:

-- This query finds high-protein cereals
SELECT name, protein 
FROM cereal 
WHERE protein > 5
ORDER BY protein DESC;

5. Clear Output Regularly

Click the "Clear" button in the output panel to remove old results and keep your workspace tidy.


Common Use Cases

Learning SQL

  • Practice basic SELECT, INSERT, UPDATE, DELETE statements
  • Experiment with JOINs, subqueries, and aggregate functions
  • Test your understanding without fear of breaking anything

Testing Queries

  • Prototype queries before using them in production
  • Test syntax across different database systems
  • Verify query logic with sample data

Sharing Examples

  • Create reproducible SQL examples
  • Share code with colleagues or students
  • Demonstrate solutions to SQL problems

Quick Calculations

  • Use SQL as a calculator with SELECT statements
  • Test date functions and string manipulations
  • Validate data transformations

Additional Features

CSV to SQL Converter

Navigate to "CSV to SQL" in the top menu to:

  1. Paste CSV data
  2. Generate INSERT statements automatically
  3. Quickly populate tables with test data

JSON to SQL Converter

Convert JSON objects into SQL INSERT statements for easy data import.

SQL Puzzles

Practice your SQL skills with interactive puzzles and challenges.

Scores

Track your progress and see how you rank against other users.


Tips for Success

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


Troubleshooting

Query didn't run?

  • Make sure you clicked the "Run" button
  • Check for syntax errors in red in the editor
  • Verify you've selected the correct database type

Results not showing?

  • Scroll down in the output panel
  • Recent results appear at the top
  • Try clicking "Clear" and re-running

Table doesn't exist?

  • Create the table first before querying it
  • Check for typos in table names
  • Use DROP TABLE IF EXISTS before CREATE TABLE

Summary

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:

  1. No installation or sign-up required
  2. Supports PostgreSQL, MySQL, MariaDB, and Oracle
  3. Real-time query execution with formatted results
  4. Multiple tabs for organizing your work
  5. Export options for sharing results

Start practicing SQL today at SQLBook.io!


Happy querying! 🎯