Skip to main content

How to Set Up Your SQL Environment (Step-by-Step)

You have learned what SQL is and how databases organize data into tables, rows, and columns. Now it is time to get your hands dirty. Before you can write your first query, you need a working SQL environment, a place where you can create databases, run queries, and see results.

The good news is that setting up an SQL environment has never been easier. Whether you want to start practicing in the next 30 seconds using an online tool, install a full database system on your machine, or work directly from the command line, this guide covers every option step by step. By the end, you will have a fully functional SQL environment loaded with a sample database, and you will have executed your very first query.

Let us get started.

Choosing the Right Setup for You

There are three main ways to set up your SQL environment. Each has its strengths, and the right choice depends on your goals and comfort level.

OptionBest ForTime to StartRequires Installation
Online toolsAbsolute beginners, quick practiceUnder 1 minuteNo
Local install with GUIOngoing learning, real projects15-30 minutesYes
Command lineDevelopers who prefer terminal workflows10-20 minutesYes
Recommendation for Beginners

If you are setting up SQL for the very first time, start with an online tool. You can begin writing queries immediately without installing anything. Once you feel comfortable with the basics, move to a local installation for a more complete experience.

Option A: Online SQL Environments (No Installation)

Online SQL tools run entirely in your browser. There is nothing to download, nothing to configure, and nothing that can go wrong with your local setup. Open a URL, start writing SQL.

DB Fiddle

DB Fiddle (https://www.db-fiddle.com) is one of the most popular online SQL playgrounds. It supports multiple database engines and lets you share your queries with others via URL.

How to get started:

  1. Open your browser and navigate to https://www.db-fiddle.com
  2. In the top-left dropdown, select your preferred database engine (choose PostgreSQL 15 or MySQL 8.0 for the most standard experience)
  3. On the left panel, paste your table creation and data insertion statements (this is your "Schema SQL")
  4. On the right panel, write your SELECT queries
  5. Click Run to execute

Here is a quick test to verify everything works. Paste this into the left panel (Schema SQL):

CREATE TABLE products (
id INTEGER PRIMARY KEY,
name VARCHAR(100),
price DECIMAL(10, 2)
);

INSERT INTO products VALUES (1, 'Wireless Mouse', 29.99);
INSERT INTO products VALUES (2, 'Mechanical Keyboard', 89.99);
INSERT INTO products VALUES (3, 'USB-C Hub', 45.00);

Then paste this into the right panel (Query SQL):

SELECT * FROM products WHERE price > 30;

Click Run, and you should see:

idnameprice
2Mechanical Keyboard89.99
3USB-C Hub45.00

If you see that result, your online environment is working perfectly.

SQLite Online

SQLite Online (https://sqliteonline.com) provides a clean, straightforward interface specifically for SQLite databases. It is excellent for beginners because SQLite has the simplest syntax with the fewest configuration options.

How to get started:

  1. Navigate to https://sqliteonline.com
  2. You will see a query editor already loaded with a sample database
  3. Clear the existing content and type your own SQL statements
  4. Click Run to execute

SQLite Online also lets you import and export database files, which is useful when you want to save your progress.

Other Online Options

ToolURLNotes
SQL Fiddlehttp://sqlfiddle.comSimilar to DB Fiddle, supports multiple engines
PostgreSQL Exerciseshttps://pgexercises.comGuided exercises with a pre-loaded database
Mode Analytics SQL Tutorialhttps://mode.com/sql-tutorialInteractive lessons with real datasets
W3Schools SQL Tryithttps://www.w3schools.com/sql/trysql.aspSimple editor with a pre-loaded sample database
Limitations of Online Tools

Online SQL environments are perfect for learning and quick experiments, but they come with limitations. You cannot create persistent databases that survive after closing the browser tab (in most tools), you cannot handle large datasets, and you cannot connect them to real applications. For serious work, you will eventually need a local installation.

Option B: Local Installation with a GUI

Installing a database system locally gives you the full experience: persistent databases, better performance, advanced features, and the ability to connect your database to real applications. A GUI (Graphical User Interface) tool makes this process beginner-friendly by providing visual interfaces for managing your databases.

We will cover the three most popular setups: SQLite with DB Browser, PostgreSQL with pgAdmin, and MySQL with MySQL Workbench.

SQLite with DB Browser (Easiest Local Setup)

SQLite is the simplest database to install because there is almost nothing to install. SQLite is a file-based database, meaning your entire database is a single file on your computer. No server to run, no configuration needed.

DB Browser for SQLite is a free visual tool for creating, designing, and editing SQLite database files.

Installation steps:

  1. Go to https://sqlitebrowser.org/dl/
  2. Download the installer for your operating system (Windows, macOS, or Linux)
  3. Run the installer and follow the default prompts
  4. Launch DB Browser for SQLite

Creating your first database:

  1. Click New Database in the toolbar
  2. Choose a location and name for your file (e.g., my_first_database.db)
  3. A dialog will appear asking you to create a table. You can do it visually or click Cancel and use SQL instead
  4. Click the Execute SQL tab
  5. Type your SQL statements and click the Play button (or press F5) to run them
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username VARCHAR(30) NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

INSERT INTO users (username, email) VALUES ('alice', 'alice@example.com');
INSERT INTO users (username, email) VALUES ('bob', 'bob@example.com');

SELECT * FROM users;

Output:

idusernameemailcreated_at
1alicealice@example.com2024-06-15 10:30:00
2bobbob@example.com2024-06-15 10:30:01
Why Start with SQLite

SQLite is the perfect "training wheels" database. It requires zero configuration, runs everywhere, and supports standard SQL syntax. Many professional applications also use SQLite in production (it powers most mobile apps, including every iOS and Android device). Learning SQLite is never wasted effort.

PostgreSQL with pgAdmin

PostgreSQL is the most feature-rich open-source relational database. It is widely used in professional environments, supports advanced SQL features, and is the database many developers recommend learning "properly" with. pgAdmin is the official GUI management tool for PostgreSQL.

Installation steps (Windows):

  1. Go to https://www.postgresql.org/download/windows/
  2. Click Download the installer (provided by EDB)
  3. Run the installer
  4. During installation, you will be asked to:
    • Choose an installation directory (default is fine)
    • Select components: make sure PostgreSQL Server and pgAdmin 4 are both checked
    • Set a password for the superuser (the default superuser is postgres). Remember this password!
    • Keep the default port (5432)
  5. Complete the installation

Installation steps (macOS):

  1. The easiest method is using Homebrew. Open Terminal and run:

    brew install postgresql@16
    brew services start postgresql@16
  2. Install pgAdmin separately by downloading it from https://www.pgadmin.org/download/

Installation steps (Linux/Ubuntu):

sudo apt update
sudo apt install postgresql postgresql-contrib
sudo systemctl start postgresql
sudo systemctl enable postgresql

Install pgAdmin by following the instructions at https://www.pgadmin.org/download/pgadmin-4-apt/

Connecting pgAdmin to your PostgreSQL server:

  1. Open pgAdmin 4
  2. In the left panel, right-click Servers and select Register > Server
  3. In the General tab, give your server a name (e.g., Local PostgreSQL)
  4. In the Connection tab:
    • Host: localhost
    • Port: 5432
    • Username: postgres
    • Password: the password you set during installation
  5. Click Save

Creating a database and running queries:

  1. Right-click your server in the left panel, select Create > Database
  2. Name it practice_db and click Save
  3. Right-click practice_db and select Query Tool
  4. Type your SQL and click the Execute/Play button (or press F5)
CREATE TABLE products (
id SERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
price DECIMAL(10, 2) CHECK (price > 0),
category VARCHAR(50),
in_stock BOOLEAN DEFAULT true
);

INSERT INTO products (name, price, category)
VALUES ('Laptop Stand', 49.99, 'Accessories');

INSERT INTO products (name, price, category)
VALUES ('Webcam HD', 79.99, 'Electronics');

SELECT * FROM products;
Common Issue: Password Authentication Failed

If you see an error like FATAL: password authentication failed for user "postgres", it means the password you entered does not match what was set during installation. On Linux, you can reset it:

sudo -u postgres psql
\password postgres

Type your new password, then try connecting again in pgAdmin.

MySQL with MySQL Workbench

MySQL is one of the most widely deployed databases in the world, especially popular in web development (it powers WordPress, Drupal, and many PHP-based applications). MySQL Workbench is the official GUI tool.

Installation steps:

  1. Go to https://dev.mysql.com/downloads/installer/ (Windows) or https://dev.mysql.com/downloads/mysql/ (macOS/Linux)
  2. Download the MySQL Installer (choose the full version)
  3. Run the installer and select Developer Default setup type
  4. This will install both MySQL Server and MySQL Workbench
  5. During configuration:
    • Keep the default port (3306)
    • Set a root password. Remember this password!
    • Optionally create additional user accounts
  6. Complete the installation

macOS alternative using Homebrew:

brew install mysql
brew services start mysql
mysql_secure_installation

Then download MySQL Workbench separately from https://dev.mysql.com/downloads/workbench/

Connecting MySQL Workbench:

  1. Open MySQL Workbench
  2. On the home screen, click the + icon next to "MySQL Connections"
  3. Enter connection details:
    • Connection Name: Local MySQL
    • Hostname: 127.0.0.1
    • Port: 3306
    • Username: root
  4. Click Test Connection, enter your root password, and confirm it works
  5. Click OK to save

Creating a database and running queries:

  1. Click on your saved connection to open it
  2. In the query editor, run:
CREATE DATABASE practice_db;
USE practice_db;

CREATE TABLE customers (
id INT AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
email VARCHAR(100) UNIQUE
);

INSERT INTO customers (first_name, last_name, email)
VALUES ('Alice', 'Johnson', 'alice@example.com');

SELECT * FROM customers;
  1. Click the lightning bolt icon to execute

DBeaver: A Universal GUI for Any Database

If you want a single tool that works with any database system, DBeaver is an excellent free, open-source option. It supports PostgreSQL, MySQL, SQLite, SQL Server, Oracle, and dozens more.

Installation:

  1. Download from https://dbeaver.io/download/
  2. Install using the default settings
  3. On first launch, DBeaver will guide you through creating a database connection
  4. Select your database type, enter your connection details, and you are ready to go

DBeaver provides a consistent interface regardless of which database you are using, making it a popular choice for developers who work with multiple database systems.

Option C: Command Line Interface

For developers who prefer working in the terminal, each database system provides a command-line client. This approach is lightweight, fast, and gives you the most direct interaction with your database.

SQLite from the Command Line

SQLite comes pre-installed on macOS and most Linux distributions. Windows users can download it from https://www.sqlite.org/download.html.

Starting SQLite:

# Create (or open) a database file
sqlite3 my_database.db

You will see the SQLite prompt:

SQLite version 3.43.0 2023-08-24 12:36:59
Enter ".help" for usage hints.
sqlite>

Running queries:

sqlite> CREATE TABLE books (
...> id INTEGER PRIMARY KEY,
...> title TEXT NOT NULL,
...> author TEXT NOT NULL,
...> year INTEGER
...> );

sqlite> INSERT INTO books VALUES (1, '1984', 'George Orwell', 1949);
sqlite> INSERT INTO books VALUES (2, 'Dune', 'Frank Herbert', 1965);

sqlite> SELECT * FROM books;
1|1984|George Orwell|1949
2|Dune|Frank Herbert|1965

Useful SQLite commands:

CommandDescription
.tablesList all tables in the database
.schema tablenameShow the CREATE statement for a table
.headers onDisplay column headers in query results
.mode columnFormat output in aligned columns
.quitExit SQLite

Make the output more readable:

sqlite> .headers on
sqlite> .mode column

sqlite> SELECT * FROM books;
id title author year
-- ----- ------------- ----
1 1984 George Orwell 1949
2 Dune Frank Herbert 1965

PostgreSQL from the Command Line (psql)

psql is the interactive terminal for PostgreSQL.

Connecting:

# Connect as the postgres user to the default database
psql -U postgres

# Connect to a specific database
psql -U postgres -d practice_db

Running queries:

postgres=# CREATE DATABASE practice_db;
CREATE DATABASE

postgres=# \c practice_db
You are now connected to database "practice_db".

practice_db=# CREATE TABLE employees (
id SERIAL PRIMARY KEY,
name VARCHAR(100),
department VARCHAR(50)
);

practice_db=# INSERT INTO employees (name, department)
VALUES ('Alice', 'Engineering');

practice_db=# SELECT * FROM employees;
id | name | department
----+-------+-------------
1 | Alice | Engineering
(1 row)

Useful psql commands:

CommandDescription
\lList all databases
\dtList all tables in the current database
\d tablenameDescribe a table's structure
\c dbnameConnect to a different database
\qQuit psql
\?Show help for psql commands

MySQL from the Command Line

Connecting:

mysql -u root -p

You will be prompted for your password. After entering it:

mysql> CREATE DATABASE practice_db;
Query OK, 1 row affected (0.01 sec)

mysql> USE practice_db;
Database changed

mysql> CREATE TABLE tasks (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(200) NOT NULL,
is_done BOOLEAN DEFAULT false
);

mysql> INSERT INTO tasks (title) VALUES ('Learn SQL basics');
mysql> INSERT INTO tasks (title) VALUES ('Set up database');

mysql> SELECT * FROM tasks;
+----+------------------+--------+
| id | title | is_done|
+----+------------------+--------+
| 1 | Learn SQL basics | 0 |
| 2 | Set up database | 0 |
+----+------------------+--------+
2 rows in set (0.00 sec)

Useful MySQL commands:

CommandDescription
SHOW DATABASES;List all databases
SHOW TABLES;List all tables in the current database
DESCRIBE tablename;Show a table's structure
USE dbname;Switch to a different database
EXIT; or \qQuit MySQL

Loading the ShopSmart Sample Database

Now that your environment is ready, let us load a sample database that you can use for practicing throughout your SQL learning journey. We will create a small e-commerce database called ShopSmart with realistic data across multiple related tables.

This database works with any of the setups described above. Copy the following SQL statements into your environment and execute them.

Adapting for Your Database

The SQL below uses standard syntax that works in PostgreSQL and SQLite. For MySQL, replace SERIAL with INT AUTO_INCREMENT and BOOLEAN values true/false with 1/0. The core queries will work identically across all three systems.

Creating the ShopSmart Tables

-- Customers table
CREATE TABLE customers (
id INTEGER PRIMARY KEY,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
city VARCHAR(50),
signup_date DATE
);

-- Product categories
CREATE TABLE categories (
id INTEGER PRIMARY KEY,
name VARCHAR(50) NOT NULL,
description TEXT
);

-- Products table
CREATE TABLE products (
id INTEGER PRIMARY KEY,
name VARCHAR(100) NOT NULL,
category_id INTEGER,
price DECIMAL(10, 2) NOT NULL,
stock_quantity INTEGER DEFAULT 0,
is_available BOOLEAN DEFAULT true,
FOREIGN KEY (category_id) REFERENCES categories(id)
);

-- Orders table
CREATE TABLE orders (
id INTEGER PRIMARY KEY,
customer_id INTEGER NOT NULL,
order_date DATE NOT NULL,
total_amount DECIMAL(10, 2),
status VARCHAR(20) DEFAULT 'pending',
FOREIGN KEY (customer_id) REFERENCES customers(id)
);

-- Order items (products in each order)
CREATE TABLE order_items (
id INTEGER PRIMARY KEY,
order_id INTEGER NOT NULL,
product_id INTEGER NOT NULL,
quantity INTEGER NOT NULL CHECK (quantity > 0),
unit_price DECIMAL(10, 2) NOT NULL,
FOREIGN KEY (order_id) REFERENCES orders(id),
FOREIGN KEY (product_id) REFERENCES products(id)
);

Inserting Sample Data

-- Insert categories
INSERT INTO categories VALUES (1, 'Electronics', 'Gadgets, devices, and accessories');
INSERT INTO categories VALUES (2, 'Books', 'Physical and digital books');
INSERT INTO categories VALUES (3, 'Home & Kitchen', 'Items for home and kitchen use');
INSERT INTO categories VALUES (4, 'Sports', 'Sports equipment and accessories');

-- Insert customers
INSERT INTO customers VALUES (1, 'Alice', 'Johnson', 'alice@email.com', 'New York', '2023-01-15');
INSERT INTO customers VALUES (2, 'Bob', 'Martinez', 'bob@email.com', 'Los Angeles', '2023-03-22');
INSERT INTO customers VALUES (3, 'Carol', 'Singh', 'carol@email.com', 'Chicago', '2023-06-10');
INSERT INTO customers VALUES (4, 'David', 'Chen', 'david@email.com', 'New York', '2023-08-05');
INSERT INTO customers VALUES (5, 'Eva', 'Brown', 'eva@email.com', 'Seattle', '2024-01-18');
INSERT INTO customers VALUES (6, 'Frank', 'Wilson', 'frank@email.com', 'Chicago', '2024-02-28');

-- Insert products
INSERT INTO products VALUES (1, 'Wireless Mouse', 1, 29.99, 150, true);
INSERT INTO products VALUES (2, 'Mechanical Keyboard', 1, 89.99, 75, true);
INSERT INTO products VALUES (3, 'USB-C Hub', 1, 45.00, 200, true);
INSERT INTO products VALUES (4, 'SQL for Beginners', 2, 34.99, 50, true);
INSERT INTO products VALUES (5, 'Data Science Handbook', 2, 42.50, 30, true);
INSERT INTO products VALUES (6, 'Coffee Maker Pro', 3, 129.99, 25, true);
INSERT INTO products VALUES (7, 'Yoga Mat Premium', 4, 38.00, 100, true);
INSERT INTO products VALUES (8, 'Running Shoes X1', 4, 110.00, 60, true);
INSERT INTO products VALUES (9, 'Bluetooth Speaker', 1, 65.00, 0, false);
INSERT INTO products VALUES (10, 'Stainless Water Bottle', 4, 24.99, 180, true);

-- Insert orders
INSERT INTO orders VALUES (1, 1, '2024-01-10', 119.98, 'completed');
INSERT INTO orders VALUES (2, 2, '2024-01-15', 89.99, 'completed');
INSERT INTO orders VALUES (3, 1, '2024-02-20', 77.49, 'completed');
INSERT INTO orders VALUES (4, 3, '2024-03-05', 129.99, 'shipped');
INSERT INTO orders VALUES (5, 4, '2024-03-12', 155.00, 'shipped');
INSERT INTO orders VALUES (6, 5, '2024-03-20', 34.99, 'pending');
INSERT INTO orders VALUES (7, 2, '2024-04-01', 63.00, 'pending');
INSERT INTO orders VALUES (8, 6, '2024-04-10', 199.98, 'pending');

-- Insert order items
INSERT INTO order_items VALUES (1, 1, 1, 2, 29.99);
INSERT INTO order_items VALUES (2, 1, 3, 1, 45.00);
INSERT INTO order_items VALUES (3, 2, 2, 1, 89.99);
INSERT INTO order_items VALUES (4, 3, 4, 1, 34.99);
INSERT INTO order_items VALUES (5, 3, 10, 1, 24.99);
INSERT INTO order_items VALUES (6, 4, 6, 1, 129.99);
INSERT INTO order_items VALUES (7, 5, 8, 1, 110.00);
INSERT INTO order_items VALUES (8, 5, 3, 1, 45.00);
INSERT INTO order_items VALUES (9, 6, 4, 1, 34.99);
INSERT INTO order_items VALUES (10, 7, 7, 1, 38.00);
INSERT INTO order_items VALUES (11, 7, 10, 1, 24.99);
INSERT INTO order_items VALUES (12, 8, 2, 1, 89.99);
INSERT INTO order_items VALUES (13, 8, 8, 1, 110.00);

Verifying the Data

After loading the data, run these quick verification queries to make sure everything is set up correctly:

-- Check row counts for each table
SELECT 'customers' AS table_name, COUNT(*) AS row_count FROM customers
UNION ALL
SELECT 'categories', COUNT(*) FROM categories
UNION ALL
SELECT 'products', COUNT(*) FROM products
UNION ALL
SELECT 'orders', COUNT(*) FROM orders
UNION ALL
SELECT 'order_items', COUNT(*) FROM order_items;

Expected output:

table_namerow_count
customers6
categories4
products10
orders8
order_items13

If your row counts match, the ShopSmart database is loaded and ready to use.

Running Your Very First Queries

With the ShopSmart database loaded, let us run a few queries to confirm everything works and give you a taste of what SQL can do.

Query 1: View All Products

SELECT name, price, stock_quantity
FROM products
ORDER BY price DESC;

Output:

namepricestock_quantity
Coffee Maker Pro129.9925
Running Shoes X1110.0060
Mechanical Keyboard89.9975
Bluetooth Speaker65.000
USB-C Hub45.00200
Data Science Handbook42.5030
Yoga Mat Premium38.00100
SQL for Beginners34.9950
Wireless Mouse29.99150
Stainless Water Bottle24.99180

Query 2: Find Customers from New York

SELECT first_name, last_name, email
FROM customers
WHERE city = 'New York';

Output:

first_namelast_nameemail
AliceJohnsonalice@email.com
DavidChendavid@email.com

Query 3: Count Products by Category

SELECT c.name AS category, COUNT(p.id) AS product_count
FROM categories c
LEFT JOIN products p ON c.id = p.category_id
GROUP BY c.name
ORDER BY product_count DESC;

Output:

categoryproduct_count
Electronics4
Sports3
Books2
Home & Kitchen1

Query 4: Find Recent Orders with Customer Names

SELECT o.id AS order_id,
c.first_name || ' ' || c.last_name AS customer,
o.order_date,
o.total_amount,
o.status
FROM orders o
JOIN customers c ON o.customer_id = c.id
ORDER BY o.order_date DESC
LIMIT 5;

Output:

order_idcustomerorder_datetotal_amountstatus
8Frank Wilson2024-04-10199.98pending
7Bob Martinez2024-04-0163.00pending
6Eva Brown2024-03-2034.99pending
5David Chen2024-03-12155.00shipped
4Carol Singh2024-03-05129.99shipped
String Concatenation Varies by Database

The || operator for combining strings works in PostgreSQL and SQLite. In MySQL, use the CONCAT() function instead:

-- MySQL version
SELECT CONCAT(c.first_name, ' ', c.last_name) AS customer
FROM customers c;

Query 5: Explore Product Details in an Order

SELECT o.id AS order_id,
p.name AS product,
oi.quantity,
oi.unit_price,
(oi.quantity * oi.unit_price) AS line_total
FROM order_items oi
JOIN orders o ON oi.order_id = o.id
JOIN products p ON oi.product_id = p.id
WHERE o.id = 1;

Output:

order_idproductquantityunit_priceline_total
1Wireless Mouse229.9959.98
1USB-C Hub145.0045.00

This query shows all items in order #1, combining data from three different tables in a single result. This is the relational model at work.

Troubleshooting Common Setup Issues

Even with straightforward installations, you may encounter a few common issues. Here are the most frequent ones and how to resolve them.

"Connection Refused" Error

Cause: The database server is not running.

Solution:

# PostgreSQL
sudo systemctl start postgresql # Linux
brew services start postgresql@16 # macOS

# MySQL
sudo systemctl start mysql # Linux
brew services start mysql # macOS

"Access Denied" or "Authentication Failed"

Cause: Incorrect username or password.

Solution: Double-check the credentials you set during installation. If you forgot your password, you will need to reset it:

# PostgreSQL password reset
sudo -u postgres psql
\password postgres

# MySQL password reset
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
FLUSH PRIVILEGES;

"Command Not Found" in Terminal

Cause: The database client is not in your system's PATH.

Solution: Either add the installation directory to your PATH or use the full path to the executable:

# Example: full path for PostgreSQL on macOS (Homebrew)
/opt/homebrew/opt/postgresql@16/bin/psql -U postgres

# Example: full path for MySQL on Windows
"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe" -u root -p

"Syntax Error" When Running SQL

Cause: Small syntax differences between database engines.

Watch for Dialect Differences
-- This works in MySQL but NOT in PostgreSQL or SQLite
CREATE TABLE test (
id INT AUTO_INCREMENT PRIMARY KEY
);

-- PostgreSQL equivalent
CREATE TABLE test (
id SERIAL PRIMARY KEY
);

-- SQLite equivalent
CREATE TABLE test (
id INTEGER PRIMARY KEY AUTOINCREMENT
);

Always check that your SQL syntax matches the specific database engine you are using.

Summary

You now have everything you need to start practicing SQL with a real environment and real data. Here is a quick recap of what was covered:

  • Online tools (DB Fiddle, SQLite Online) let you start in seconds with zero installation
  • Local GUI tools (DB Browser for SQLite, pgAdmin, MySQL Workbench, DBeaver) provide a complete, persistent environment for serious learning and development
  • Command-line clients (sqlite3, psql, mysql) offer a fast, lightweight way to interact with databases directly from the terminal
  • The ShopSmart sample database gives you 5 interconnected tables with realistic e-commerce data to practice with
  • Your first queries demonstrated SELECT, WHERE, JOIN, GROUP BY, ORDER BY, and LIMIT, covering a solid range of fundamental SQL operations

Pick the setup that feels most comfortable, load the ShopSmart database, and start experimenting. The best way to learn SQL is to write queries, see results, tweak them, and repeat. Your environment is ready. Now the real learning begins.