Postgres commands

1. Access postgresSQL.

->su postgres

2. Create user.

->CREATE USER username

3. Delete user.

-> DROP USER username

4. Create user can create DATABASE/


5. List all user.


6.This lists databases:

->SELECT datname FROM pg_database;


7.This lists tables in the current database

->SELECT table_schema,table_name FROM information_schema.tables ORDER BY table_schema,table_name;


8.Select particular database with specific user.

-> psql databaseName userName;

->psql databaseName

->\c databaseName

9. List info about current database connection.


10.List database list.


11. List all user.


12.Quits the psql program


13.To exit from psql command line utilities.
->\q type and press enter
14. Describe table like mysql.
>\d+ tablename

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s