-
-
Save erangaeb/93d446b67336ebf47245 to your computer and use it in GitHub Desktop.
Psql commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # connect | |
| psql -h <host> -p <port> -U <user> | |
| psql -h dev.localhost -p 15534 -U postgres | |
| # list databases | |
| \list | |
| # connect to database | |
| \connect <databasename> | |
| \connect senz | |
| # select query | |
| select * from employee where name='eranga' | |
| # update query | |
| update employee set name = ‘eranga’ where id=’12'; | |
| # list tables | |
| \dt | |
| # view table structure | |
| \d+ <table name> | |
| \d+ employee | |
| # exeucte sql script | |
| psql -Upostgres -d senz -h dev.localhost -f updateSenz.sql -p 15534 | |
| # base64 decode | |
| decode('<encoded data>', 'base64') | |
| #base64 encode | |
| encode('<data>', 'base64') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment