psql in PostgreSQL?psql is a command-line tool that lets you interact with a PostgreSQL database by typing commands and queries directly.
psql?Use the command psql -d database_name -U username. This opens a session connected to the specified database as the given user.
\q do in psql?\q quits the psql tool and ends your session.
psql?Type \dt to see a list of all tables in the connected database.
\? in psql?\? shows help information listing all available psql commands and their descriptions.
psql tool?The command \q is the correct way to quit psql. Other options are not valid commands in psql.
psql?\dt lists all tables. \list shows databases, and the others are not valid psql commands.
psql -d mydb -U user1 do?This command connects you to the database mydb as the user user1.
psql commands?\? displays help for psql commands. man psql shows the manual but outside psql.
psql, what must you end the query with?SQL queries in psql must end with a semicolon ; to execute.
psql session to connect to a PostgreSQL database.psql meta-commands and what they do.