You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Before writing SQL, you need a place to run it. In this lesson, we'll set up a free, browser-based SQL environment so you can follow along with every lesson.
The easiest way to get started is sqliteonline.com — a free, browser-based SQL editor. No installation required.
DB Fiddle lets you choose between SQLite, MySQL, and PostgreSQL. Great for testing compatibility across databases.
If you want to install a real database locally:
# macOS (using Homebrew)
brew install postgresql@16
brew services start postgresql@16
# Ubuntu / Debian
sudo apt-get install postgresql postgresql-contrib
sudo systemctl start postgresql
# Windows
# Download installer from postgresql.org/download/windows
psql is the PostgreSQL interactive terminal — a command-line client that ships with every PostgreSQL installation. It lets you connect to a database and run SQL queries directly from your terminal.
PostgreSQL listens on port 5432 by default.
Connect to your local server using the -U flag to specify the username:
psql -U postgres
The -U flag stands for user — it tells psql which database user to authenticate as.
Once inside psql you interact with it using meta-commands (also called backslash commands). These are not SQL — they are shortcuts understood only by the psql client.
| Command | What it does |
|---|---|
\l | List all databases on the server |
\c dbname | Connect (switch) to a different database |
\dt | Show tables in the current database |
\q | Quit the psql terminal |
Example session:
postgres=# \l -- list all databases
postgres=# \c mydb -- switch to the database called mydb
mydb=# \dt -- show tables in mydb
mydb=# \q -- exit psql
If you prefer a graphical interface instead of the terminal, pgAdmin is the most popular free GUI tool for PostgreSQL. It lets you browse databases, run queries, and manage tables through a web-based interface — no command-line required.
Other popular GUI clients include DBeaver and TablePlus.
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.