PostgreSQL

From WhyAskWhy.org Wiki
Revision as of 10:50, 10 September 2014 by Deoren (talk | contribs) (Added database category)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Character length restrictions

Using comments

Login

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

sudo su postgres
psql


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

References