Version of PostgreSQL:
cmd:select version();
Creating the user in the shell prompt:
cmd:create user postgres_user;
Creating the database in the shell prompt:
cmd:
/usr/local/pgsql/bin/createdb my_db -O postgres -p 5435;
-> To query the created database use the cmd:
Get a list of databases in a Postgresql database:
cmd:\l
Delete/Drop an existing PostgreSQL database:
cmd:DROP DATABASE test;
Getting help on postgreSQL commands:
-> We can get the syantax for create,delete,index etc. by using the \h and the required syntax name.
cmd:\h CREATE
Get a list of all the tables in a Postgresql database:
cmd: \d
To turn on timing, and checking how much time a query takes to execute:
-> After this if you execute a query it will show how much time it took for doing it.
cmd:\timing
cmd:select * from attribute_master_abstract limit 2;
To see the list of available functions in PostgreSQL:
cmd:\df or \df+