This is a draft cheat sheet. It is a work in progress and is not finished yet.
GETTING STARTED WITH POSTGRES FROM CLI
START SERVER |
pg_ctl start -l "$PGDATA/server.log"
|
CREATE DATABASE |
createdb -U dev <DATABASE>
|
IMPORT |
psql <DATABASE> < <PATH-TO-FILENAME>
|
IMPORT (alternative) |
psql -U dev -d <DATABASE> -f <PATH-TO-FILENAME>
|
SERVER STATUS |
|
DROP DATABASE |
|
PSQL SHELL LOGIN
Login |
psql -h <HOSTNAME> -U <USERNAME> <DATABASE>
|
PSQL SHELL META-COMMANDS
List Databases |
|
this prompt <DATABASE>=#
|
means super-user |
Tables in Databases |
|
this prompt <DATABASE>=>
|
means normal user |
Public Tables |
|
this prompt <DATABASE>-#
|
means continuation |
Public Tables with Size and Description |
|
To Exit/Quit |
|
Connect to Other |
|
|