Skip to content

Instantly share code, notes, and snippets.

@bruno-uy
Created May 27, 2021 13:38
Show Gist options
  • Save bruno-uy/0b065d9e3d41812a7b17fcc60960b4c9 to your computer and use it in GitHub Desktop.
Save bruno-uy/0b065d9e3d41812a7b17fcc60960b4c9 to your computer and use it in GitHub Desktop.
Check if columns exists in Redshift table
-- You can count the rows to be equal to columns that you're checking
SELECT *
FROM information_schema.columns
WHERE table_schema = '<table_schema>'
AND table_name = '<table_name>'
AND column_name IN ('<column1>', '<column2>');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment