daily pastebin goal
13%
SHARE
TWEET

Untitled

a guest Mar 20th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. +----+------+------+-------+
  2. | id | code | name | price |
  3. +----+------+------+-------+
  4.      
  5. +----+------+------+
  6. | id | code | name |
  7. +----+------+------+
  8.      
  9. SELECT column_name
  10. FROM information_schema.columns
  11. WHERE table_name = "products"
  12. AND table_schema = "schema_a"
  13. AND column_name NOT IN (
  14.   SELECT GROUP_CONCAT(""", column_name, """)
  15.   FROM information_schema.columns
  16.   WHERE table_name = "products"
  17.   AND table_schema = "schema_b"
  18. );
  19.      
  20. SELECT column_name
  21. FROM information_schema.columns
  22. WHERE table_name = "products"
  23. AND table_schema = "schema_a"
  24. AND column_name NOT IN ("id", "code", "name");
  25.      
  26. SELECT t1.column_name
  27. FROM (SELECT column_name
  28.       FROM information_schema.columns
  29.       WHERE table_name = "products"
  30.         AND table_schema = "schema_a") t1
  31. LEFT JOIN (SELECT column_name
  32.            FROM information_schema.columns
  33.            WHERE table_name = "products"
  34.              AND table_schema = "schema_b") t2 ON t1.column_name = t2.column_name
  35. WHERE t2.column_name IS NULL
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top