|< < 7 > >|

psql

psql is the main tool for interacting with Postgres.

  • You can use it to enter commands manually, on the command line.

  • Usually, it is better to put commands in a script and execute the script.

Manually

jao@mintyzack ~ $ psql jao Pager usage is off. psql (9.5.10) Type "help" for help. jao=# create table t(x int); CREATE TABLE jao=# insert into t values(1), (2), (3); INSERT 0 3 jao=# select * from t; x --- 1 2 3 (3 rows) jao=#
  • psql jao: Runs psql on the database jao, (which must have been created already).

  • create table ...: Creates a table, (duh!)

  • select * from t: select all columns (denoted by *) from table t.

|< < 7 > >|