MYSQL query table information

The SELECT
a.table_name table,
a.ordinal_position sequence number field,
a.COLUMN_NAME field names,
a.DATA_TYPE data type,
Case a.column_key When 'PRI' the then the else. 1 0 End AS primary key,
Case When Extra 'AUTO_INCREMENT' the then the else. 1 0 end as growth since,

Case When the then character_maximum_length IS NULL NUMERIC_PRECISION the else character_maximum_length End AS length,
Case a.is_nullable When 'Yes' 0 the then empty the else. 1 End allowed AS,
column_default default value,
column_comment field specifies the AS
fROM information_schema.COLUMNS a

Guess you like

Origin www.cnblogs.com/aweifly/p/12356183.html