psql is PostgreSQL’s interactive command-line client. Use it to connect to a database, enter SQL statements, inspect tables, and perform database-administration tasks. After installing PostgreSQL, make the psql command available in your terminal or invoke it with its full installation path. section 8.2.3
A practical psql workflow moves from connection to database setup and inspection:
- Connect as the default administrative user with psql -U postgres -d postgres. section 8.2.3
- Create a separate user, grant it CREATEDB, and connect using that account. section 8.2.3
- Create a database, switch to it with \c, and confirm the active psql prompt. section 8.2.3
- Run SQL to create tables, insert records, query rows, update values, delete records, and inspect tables with \dt. section 8.2.4
Connecting to an application database
After creating haikudb for the application, connect directly with psql -U haiku_lord -d haikudb. At the resulting prompt, CREATE TABLE, INSERT, SELECT, UPDATE, and DELETE statements operate on that database. Use \dt to list its tables and verify that setup succeeded. section 8.2.3 section 8.2.4
psql -U postgres -d postgres
Use the connection command as the starting point for an interactive psql session. section 8.2.3


