Contents
Unix
psql basics
Launch psql with your postgresql user name:
psql -U user-name database-name
The psql prompt:
- includes the name of the database you're working on right now (e.g. "books=#" or "olympics=#")
- shows = when it's ready for a new \-directive or SQL query ("books=#")
- shows - when you're in the middle of an SQL query ("books-#")
The rest of these are "psql directives"—stuff you type at the psql prompt.
- \q [quit]
- \d [list all tables in this database]
- \q [quit]
- \q [quit]
- \q [quit]
- \q [quit]
- \q [quit]
- \q [quit]
build database from scratch
clear or remove database
copy database to a different computer