kymbrik
12/20/2017 - 10:48 AM

PostgreSQL commands

Подключение
sudo -u ermakov psql



Перезагрузка
sudo service postgresql restart



Подключение к определенной БД 
\c databasename

mysql: SHOW TABLES
postgresql: \d
postgresql: SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';


mysql: SHOW DATABASES
postgresql: \l
postgresql: SELECT datname FROM pg_database;


mysql: SHOW COLUMNS
postgresql: \d table
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name ='table';


mysql: DESCRIBE TABLE
postgresql: \d+ table
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name ='table';

CREATE TABLE "responses" (
	"response" jsonb NOT NULL
) WITH (
  OIDS=FALSE
);