I want to get all enum data type from Mysql database. remember a thing that my table have no data. I read some other post but they have not specific answer as I want. Please someone can help me.
Asked
Active
Viewed 952 times
-1
-
possible duplicate of [How can I get enum possible values in a MySQL database?](http://stackoverflow.com/questions/2350052/how-can-i-get-enum-possible-values-in-a-mysql-database) – Haim Evgi Mar 05 '12 at 07:22
-
I have blank table and hope it's not worked for me. – user1249186 Mar 05 '12 at 07:26
-
1The table can be empty, but enum values cannot be empty. – Devart Mar 05 '12 at 07:37
-
Possible duplicate of [How can I get enum possible values in a MySQL database?](https://stackoverflow.com/questions/2350052/how-can-i-get-enum-possible-values-in-a-mysql-database) – Brian Tompsett - 汤莱恩 May 08 '18 at 06:28
2 Answers
0
I do so:
SELECT DISTINCT(data_type) FROM information_schema.
COLUMNSWHERE table_schema =<Your database>
0
Try this query to get all ENUM values -
SELECT
TRIM(TRAILING ')' FROM TRIM(LEADING '(' FROM TRIM(LEADING 'enum' FROM column_type))) enun_values
FROM
information_schema.`COLUMNS`
WHERE
TABLE_SCHEMA = 'db_name' AND
TABLE_NAME = 'table_name' AND
COLUMN_NAME = 'col_name';

Devart
- 119,203
- 23
- 166
- 186