Skip to content

Instantly share code, notes, and snippets.

@psahni
Last active April 30, 2024 07:39
Show Gist options
  • Save psahni/b54cda8c3703ab7239202ddfd48427ea to your computer and use it in GitHub Desktop.
Save psahni/b54cda8c3703ab7239202ddfd48427ea to your computer and use it in GitHub Desktop.
all about postgres

Connect

psql -U postgres

Create Db

CREATE DATABASE my_test_db

List Db

\l

Use Db

\c my_test_db

List Tables

\d

Alter Table

ALTER TABLE table_name ADD COLUMN IF NOT EXISTS column_name INTEGER;

ALTER TABLE table_name DROP COLUMN IF EXISTS column_name;

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