-
Notifications
You must be signed in to change notification settings - Fork 3
SQL compare two tables
ghdrako edited this page May 3, 2024
·
1 revision
-
https://github.com/dbt-labs/dbt-audit-helper#compare_relations-source
-
https://github.com/gregw2hn/handy_sql_queries/blob/main/sql_diff.sql
-
https://www.sqlite.org/sqldiff.html utility:
By default it compares whole databases, but it can be told to only compare a specific table in each:
sqldiff -t mytable database1.sqlite database2.sqlite
-
CHECKSUM
select * from (
(
select *
from table1
minus
select *
from table2
)
union all
(
select *
from table2
minus
select *
from table1
)
)
Test