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='数据库名';

posted @ 2020-12-24 19:40  追极  阅读(4895)  评论(0编辑  收藏  举报