Created
May 4, 2016 20:44
-
-
Save utdrmac/9297fe2cf3dafb4f662491a46caeda6d to your computer and use it in GitHub Desktop.
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 t.table_schema, t.engine, t.table_name, c.column_name, c.column_type | |
FROM information_schema.tables AS t | |
INNER JOIN information_schema.columns AS c ON c.table_schema = t.table_schema | |
AND c.table_name = t.table_name | |
LEFT OUTER JOIN information_schema.innodb_sys_tables AS ist | |
ON ist.name = concat(t.table_schema,'/',t.table_name) | |
LEFT OUTER JOIN information_schema.innodb_sys_columns AS isc | |
ON isc.table_id = ist.table_id AND isc.name = c.column_name | |
WHERE c.column_type IN ('time','timestamp','datetime') | |
AND t.table_schema NOT IN ('mysql','information_schema','performance_schema') | |
AND t.table_type = 'base table' | |
AND (t.engine = 'innodb' and isc.mtype = 6) | |
ORDER BY t.table_schema, t.table_name, c.column_name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment