mysql查询字段、拼接字段


1.mysql查询表的所有字段

select COLUMN_NAME,column_comment from INFORMATION_SCHEMA.Columns where table_name='表名' and table_schema='数据库名';

2.mysql拼接所有字段,方便写sql

select group_concat( COLUMN_NAME separator ', ')  from INFORMATION_SCHEMA.Columns where table_name='表名' and table_schema='数据库名';