Если у вас нет дубликатов, вы можете сделать это ...
SELECT
(SELECT COUNT(*) FROM (SELECT * FROM table1 UNION SELECT * FROM table2)) AS unioned,
(SELECT COUNT(*) FROM table1) AS table1,
(SELECT COUNT(*) FROM table2) AS table2
Все три цифры должны совпадать, если две таблицы совпадают.
Тот же подход можно использовать, если есть дубликаты, добавив поле подсчета ...
WITH
table1 AS (SELECT a, b, c, d, COUNT(*) AS duplicates FROM table1 GROUP BY a, b, c, d),
table2 AS (SELECT a, b, c, d, COUNT(*) AS duplicates FROM table2 GROUP BY a, b, c, d)
SELECT
(SELECT COUNT(*) FROM (SELECT * FROM table1 UNION SELECT * FROM table2)) AS unioned,
(SELECT COUNT(*) FROM table1) AS table1,
(SELECT COUNT(*) FROM table2) AS table2