25 March 2020

Compare values from columns of multiple tables. This query can be used to compare two tables in such manner in postgres.

Source code viewer
  1. SELECT comparing_columns FROM my_table_1
  2. EXCEPT
  3. SELECT comparing_columns FROM my_table_2
  4.  
  5. -- If the tables/schemas are absolutely identical.
  6. SELECT * FROM my_table_1
  7. EXCEPT
  8. SELECT * FROM my_table_2
Programming Language: PostgreSQL