#sql query field name, comment operation splicing
#Query field names and comments
select COLUMN_NAME,COLUMN_COMMENT from information_schema.COLUMNS where table_name = 'Table name' and table_schema = 'Library name& #39; order by ordinal_position
#Query the entire content
select * from information_schema.COLUMNS where table_name = 'Table name' and table_schema = 'Library name' order by ordinal_position
#拼接 group_concat(field,SEPARATOR '拼接字符')
select group_concat(COLUMN_NAME SEPARATOR ';'),group_concat(COLUMN_COMMENT SEPARATOR ';') from information_schema.COLUMNS where table_name = '表名' and table_schema = '库名' order by ordinal_position
#Ordinal field splicing group_concat(field order by field,SEPARATOR 'character')
select group_concat(COLUMN_NAME order by ordinal_position SEPARATOR ' ;'),group_concat(COLUMN_COMMENT ORDER BY ordinal_position SEPARATOR ';') from information_schema.COLUMNS where table_name = 'Table name' and table_schema = 'Library name ' order by ordinal_position
#整个库下的所有表
select TABLE_NAME,group_concat(COLUMN_NAME order by ordinal_position SEPARATOR ';'),group_concat(COLUMN_COMMENT ORDER BY ordinal_position SEPARATOR ';') from information_schema.COLUMNS where table_schema = '库名' GROUP BY TABLE_NAME
' '),group_concat(COLUMN_COMMENT ORDER BY ordinal_position SEPARATOR ';') from information_schema.COLUMNS GROUP BY TABLE_NAME,TABLE_SCHEMA ORDER BY TABLE_SCHEMA
#Splice database name and table name
select CONCAT(TABLE_SCHEMA,'.',TABLE_NAME) from information_schema.COLUMNS GROUP BY TABLE_NAME,TABLE_SCHEMA ORDER BY TABLE_SCHEMA;