Install PostgreSQL, connect to it with the psql command-line client, create your first database, and learn the everyday psql commands.
Why: you need a running PostgreSQL server to practise against. Install PostgreSQL — the installer runs the server on port 5432 and asks you to set a password for the built-in "postgres" superuser. The installer also includes psql, the command-line client you use in the next step.
Why: psql is the official command-line client for PostgreSQL — a live prompt where you type SQL and see results immediately. -U picks the user, -h the host. When the prompt changes to "postgres=#" you are connected.
Connect from your terminal as the "postgres" superuser:
psql -U postgres -h localhostWhy: a fresh server starts almost empty, so your first job is to create a database to hold your tables. Note: SQL statements end with a semicolon. Commands that start with a backslash (like \c) are psql shortcuts, not SQL — they do not take a semicolon.
Run these inside psql:
CREATE DATABASE shop;\c shopWhy: these backslash shortcuts are how you look around a database — what tables exist, what columns a table has, who the users are. You will use \dt and \d constantly.
\l list all databases
\dt list the tables in the current database
\d users describe the "users" table (columns, types, indexes)
\du list roles (users)
\c shop connect to the database named "shop"
\? help for psql backslash commands
\h SELECT SQL help for a specific command
\q quit psqlWhy: you keep your tables and starting data in .sql files so you can recreate the whole database any time by re-running the file — this is how real projects track their schema.
From your normal terminal (not inside psql):
psql -U postgres -d shop -f schema.sqlOr, if you are already inside psql:
\i schema.sql