Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- +----+------+------+-------+
- | id | code | name | price |
- +----+------+------+-------+
- +----+------+------+
- | id | code | name |
- +----+------+------+
- SELECT column_name
- FROM information_schema.columns
- WHERE table_name = "products"
- AND table_schema = "schema_a"
- AND column_name NOT IN (
- SELECT GROUP_CONCAT(""", column_name, """)
- FROM information_schema.columns
- WHERE table_name = "products"
- AND table_schema = "schema_b"
- );
- SELECT column_name
- FROM information_schema.columns
- WHERE table_name = "products"
- AND table_schema = "schema_a"
- AND column_name NOT IN ("id", "code", "name");
- SELECT t1.column_name
- FROM (SELECT column_name
- FROM information_schema.columns
- WHERE table_name = "products"
- AND table_schema = "schema_a") t1
- LEFT JOIN (SELECT column_name
- FROM information_schema.columns
- WHERE table_name = "products"
- AND table_schema = "schema_b") t2 ON t1.column_name = t2.column_name
- WHERE t2.column_name IS NULL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement