Last active
May 11, 2017 13:50
-
-
Save ramiroaznar/9d521807f14b47af2beff9afef7e9a5c to your computer and use it in GitHub Desktop.
Check common columns in two tables in PostgreSQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with a as ( | |
SELECT column_name | |
FROM information_schema.columns | |
WHERE table_name = 'world_borders' | |
), | |
b as ( | |
SELECT column_name | |
FROM information_schema.columns | |
WHERE table_name = 'populated_places' | |
) | |
select a.column_name, b.column_name as other from a, b | |
where a.column_name = b.column_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment