当前位置:Gxlcms > 数据库问题 > 获取数据库字段小技巧

获取数据库字段小技巧

时间:2021-07-01 10:21:17 帮助过:6人阅读

下面写了几条根据数据库表,获取domain中要用的数据字段sql语句。

select
concat(
concat(column_name,
concat(‘=‘,
concat(concat(‘#{‘,column_name),‘}‘)
)
),‘,‘)

from information_schema.`COLUMNS` where table_schema=‘saas-export‘ and table_name=‘ss_company‘;

以上sql语句获得的结果如id=#{id},

select
concat(column_name,concat(‘=‘,concat(concat(‘#{‘,concat(column_name,‘}‘)),‘,‘)))
from information_schema.`COLUMNS` where table_schema=‘saas-export‘ and table_name=‘ss_company‘

以上sql语句获得的结果如id=#{id},

select column_name,data_type,column_comment from information_schema.COLUMNS where table_schema=‘saas-export‘ and table_name=‘ss_company‘
以上sql语句获得的结果如
id varchar ID
name varchar 公司名称


获取数据库字段小技巧

标签:for   mat   ble   arc   技巧   获得   名称   table   数据库   

人气教程排行