Skip to content

Instantly share code, notes, and snippets.

@davidbarkhuizen
Last active November 1, 2022 11:37
Show Gist options
  • Select an option

  • Save davidbarkhuizen/4b4aa2afae7d1a87ea43ad619c256e4f to your computer and use it in GitHub Desktop.

Select an option

Save davidbarkhuizen/4b4aa2afae7d1a87ea43ad619c256e4f to your computer and use it in GitHub Desktop.
postgresql

switch to posgres user

sudo -i -u postgres

create database xxx

createdb xxx

console comands

quit console

/q

list databases

\l

use (connect to) db xxx

\c xxx

list tables in database

select * from pg_catalog.pg_tables;

describe a table

select column_name, data_type, character_maximum_length from INFORMATION_SCHEMA.COLUMNS where table_name = '';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment