Last active
May 15, 2018 11:01
-
-
Save kkasaei/1e154a477f754fcd4d5e141683131834 to your computer and use it in GitHub Desktop.
This file contains 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
SHOW TABLE: | |
Postgres psql needs escaping for capital letters. | |
Database=# \d+ "TestTable1" | |
Describe Table: | |
\d "myTable" describe table | |
\d+ "myTable" | |
Switch Database | |
\c tableName | |
Create Database: | |
create database "testdb2" OWNER postgres; | |
\q + enter -> Exit; | |
Import Database: | |
psql -U postgres database < SqlScript.sql' | |
Creating Roles | |
CREATE USER node_user WITH SUPERUSER PASSWORD 'node_password'; | |
Checking for Users | |
SELECT * FROM PG_USER; | |
Update | |
UPDATE database SET column($1) WHERE id=($2), [$1 value, $2 value] | |
Delete | |
DELTE from databsae where id= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Started a Gist regarding Postgres commands