SQL compare two tables - ghdrako/doc_snipets GitHub Wiki
-
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
)
)