Build the mental model
`psql` is PostgreSQL's official interactive terminal. SQL statements end with a semicolon, while backslash meta-commands such as `\l`, `\dt`, and `\d` provide client-side shortcuts. If the prompt changes unexpectedly, an open quote or parenthesis may be waiting; `\r` clears the input buffer.
Connect it to a real scenario
Enter `tutorial_platform` using the container's `psql`. Query the server version, current database, and current user, then inspect the session with `\conninfo`. During later lessons, run saved SQL files with `\i filename.sql`.
Try the working example
docker exec -it pg-tutorial psql -U postgres -d tutorial_platform
SELECT version();
SELECT current_database(), current_user;
\conninfo
\dt
\qYou see PostgreSQL 18.x, the `tutorial_platform` database, and the `postgres` user.5-minute try-it
Open meta-command help with `\?` and find commands that list databases, tables, and functions.
One important caution
Do not write `\dt;`; a meta-command is not a SQL statement and needs no semicolon.
PostgreSQL — psql — PostgreSQL Global Development Group