Created
September 5, 2022 09:27
-
-
Save shellj/f353eea5453d9b1493c70820e3875c5c to your computer and use it in GitHub Desktop.
get the difference between two tables in MySQL
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
SELECT table_name, | |
column_name, | |
ordinal_position, | |
data_type, | |
column_type, | |
COLUMN_DEFAULT, | |
COLUMN_COMMENT | |
FROM (SELECT table_name, | |
column_name, | |
ordinal_position, | |
data_type, | |
column_type, | |
COLUMN_DEFAULT, | |
COLUMN_COMMENT | |
FROM information_schema.columns | |
WHERE table_schema in ('message', 'data_archive') | |
AND table_name IN ('message', '2022_message') | |
GROUP BY column_name, ordinal_position, | |
data_type, column_type, COLUMN_DEFAULT, COLUMN_COMMENT | |
HAVING COUNT(1) = 1) A; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment