Last active
October 29, 2016 09:26
-
-
Save bitkorn/3b3df8829b3c813f5da5aaa78fe25290 to your computer and use it in GitHub Desktop.
get possible ENUM values from a MySQL table column
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
-- @return(raw) ('firstenumvalue','secondenumvalue','...') | |
SELECT | |
-- cut the word 'enum' | |
SUBSTRING(COLUMN_TYPE, 5) | |
FROM | |
information_schema.COLUMNS | |
WHERE | |
TABLE_SCHEMA = 'schemaname' | |
AND TABLE_NAME = 'tablename' | |
AND COLUMN_NAME = 'columnname'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment