Running Postgresql Queries from Linux Command’s Terminal

To Access Postgresql Interface, Enter command

$ psql db_name

You will be switched to shell below

psql (9.5.5)
Type “help” for help.


Now run your queries as:

Queries for Information Schemas
db_name=# select table_name from information_schema.tables;
db_name=# select table_name from information_schema.tables where table_name is like ‘%cms%’;
db_name=# select table_name from information_schema.columns where table_name = ‘res_users’;

Queries for User Defined Tables
db_name=# select name, father_name from cms_entryregis where id in (1,2,3,4,5);


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