Author: techfox9

PostgreSQL (postgres) quick notes..

Friday, March 28th, 2008 @ 4:01 pm

  • psql -U postgres [-d database]
  • \list : List of databases.
  • \d : show tables.
  • \d “table” (d-quotes) : show columns in table “table”.
  • \o : output to file.
  • \f [string] : set field separator.
  • \h : help.
  • \q : quit.
  • \c database : change database.
  • \i script_name : run an SQL script.
  • Queries:

  • select * from “table”; (d-quotes for table name)
  • SELECT column_name FROM information_schema.columns
    WHERE table_name =”_table_” ORDER BY ordinal_position;

PostgreSQL


 


Comments are closed.