Skip to content

Instantly share code, notes, and snippets.

@SanthoshBabuMR
Last active October 13, 2020 03:41
Show Gist options
  • Save SanthoshBabuMR/3c7cbf32bc625769572e2e3a76043079 to your computer and use it in GitHub Desktop.
Save SanthoshBabuMR/3c7cbf32bc625769572e2e3a76043079 to your computer and use it in GitHub Desktop.
postgres cheatsheet
-- find tables
SELECT *
FROM information_schema.tables
WHERE table_schema = 'public'
and table_name like '%pattern%'
ORDER BY table_type, table_name;
-- DESC table
SELECT
table_name,
column_name,
data_type
FROM
information_schema.columns
WHERE
table_name = '<table_name>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment