Skip to content

Instantly share code, notes, and snippets.

@bitkorn
Last active October 29, 2016 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitkorn/3b3df8829b3c813f5da5aaa78fe25290 to your computer and use it in GitHub Desktop.
Save bitkorn/3b3df8829b3c813f5da5aaa78fe25290 to your computer and use it in GitHub Desktop.
get possible ENUM values from a MySQL table column
-- @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