-1

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.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

2 Answers2

0

I do so:

SELECT DISTINCT(data_type) FROM information_schema.COLUMNSWHERE table_schema =<Your database>

INFORMATION_SCHEMA Tables

DIF
  • 2,470
  • 6
  • 35
  • 49
bboybit
  • 26
  • 1
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