From Wiki
Revision as of 11:50, 10 September 2014 by Deoren (talk | contribs) (Added commands for logging in, showing databases and tables.)
Jump to: navigation, search

Character length restrictions

Using comments


This is probably not the best way, but it's what I've learned to do so far:

sudo su postgres

Connect to a database

\c database_name

Show all databases

  • \list
  • SELECT datname FROM pg_database WHERE datistemplate = false;

Show all tables in the current database

  • \dt
  • SELECT table_schema,table_name FROM information_schema.tables ORDER BY table_schema,table_name;

Create a database

Create a user for that database with full privileges to it

Reset password for user account

Import or run SQL statements from file

Insert a new row

Update field

Delete row

Delete user account

Delete database

Resetting the root user account

Viewing privileges granted to a user