工作中,编写xmlsql时需要查询全部字段,可以利用sql快速组装所有的列
1.查询所有的表名
select table_name,table_comment,auto_increment from information_schema.`TABLES` where table_schema = 'seata';
2.查询某个表的所有字段
select column_name,data_type,column_comment,column_key,extra,character_maximum_length,is_nullable,column_default
from information_schema.columns
where table_schema = 'seata' and table_name = 'users' ;
3.组装表的所有列文章来源:https://www.toymoban.com/news/detail-529725.html
select GROUP_CONCAT("t.",column_name) total
from information_schema.columns
where table_schema = 'seata' and table_name = 'users' and column_name not in ('id');
文章来源地址https://www.toymoban.com/news/detail-529725.html
到了这里,关于mysql 查询数据库所有表,表字段的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!