Created
September 3, 2015 08:08
-
-
Save scalopus/023b8fa9ed5b7d3e3d2a to your computer and use it in GitHub Desktop.
Compare Schema on Two Table
This file contains hidden or 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, | |
is_nullable, | |
CHARACTER_MAXIMUM_LENGTH, | |
CHARACTER_OCTET_LENGTH, | |
NUMERIC_PRECISION, | |
NUMERIC_SCALE, | |
DATETIME_PRECISION, | |
CHARACTER_SET_NAME, | |
COLLATION_NAME, | |
EXTRA FROM | |
( | |
SELECT | |
table_name, | |
column_name, | |
ordinal_position, | |
data_type, | |
column_type, | |
column_default, | |
is_nullable, | |
CHARACTER_MAXIMUM_LENGTH, | |
CHARACTER_OCTET_LENGTH, | |
NUMERIC_PRECISION, | |
NUMERIC_SCALE, | |
DATETIME_PRECISION, | |
CHARACTER_SET_NAME, | |
COLLATION_NAME, | |
EXTRA, | |
COUNT(1) rowcount | |
FROM information_schema.columns | |
WHERE table_schema=DATABASE() | |
AND table_name IN ('v_listing','view_listing_temp') | |
GROUP BY | |
column_name, | |
ordinal_position, | |
data_type, | |
column_type, | |
column_default, | |
is_nullable, | |
CHARACTER_MAXIMUM_LENGTH, | |
CHARACTER_OCTET_LENGTH, | |
NUMERIC_PRECISION, | |
NUMERIC_SCALE, | |
DATETIME_PRECISION, | |
CHARACTER_SET_NAME, | |
COLLATION_NAME, | |
EXTRA | |
HAVING COUNT(1)=1 | |
) A | |
order by ordinal_position asc, table_name asc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment