Skip to content

Latest commit

 

History

History
67 lines (51 loc) · 615 Bytes

postgresql.md

File metadata and controls

67 lines (51 loc) · 615 Bytes

PostgresSQL

Some tips in bulk

Use postgres user

sudo su postgres

Launch client

psql

Pivot columns to lines

\x

Create

CREATE DATABASE database_name;
CREATE USER user_name WITH ENCRYPTED PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE database_name to user_name;
ALTER USER user_name CREATEDB;

Use database

\c database_name

Describe

Table

\d table_name
\d+ table_name

List

Database

\l

Table

\dt
\dt+