PostgreSQL chear sheet
2012 January 22
Since I have been using MySQL for a long time, transition to PostgreSQL is a little bit difficult. I will be posting some useful commands here for my own reference. This post will be getting updated a lot.
I have explained how to install PostgreSQL on FreeBSD 8.2 in my previous post.
To create a database:
#su pgsql $ createdb db_name $ exit
To drop a database:
#su pgsql $ dropdb db_name $ exit
To list all databases:
#psql -l
To open psql prompt for a database and a user:
#psql db_name -U user
After opening psql prompt with psql db_name -U user
To list all tables in a database:
\d
To describe a table structure:
\d table_name
Psql help:
\?
To quit psql prompt:
\q
No comments yet