工作中,編寫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.組裝表的所有列文章來源:http://www.zghlxwxcb.cn/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');
文章來源地址http://www.zghlxwxcb.cn/news/detail-529725.html
到了這里,關于mysql 查詢數據庫所有表,表字段的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!