SELECT TABLE_SCHEMA AS `databaseName`, TABLE_NAME AS `tableName`, COLUMN_NAME AS `columnName`, DATA_TYPE AS `columnType`, COLUMN_COMMENT AS `columnComment` FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = '数据库名称' AND `TABLE_NAME` = '表名' ;
其中 TABLE_SCHEMA 和 TABLE_NAME 分别改成对应数据库和表名即可 结果:
atabaseName tableName columnName columnType columnComment ------------ --------- ---------- ---------- ---------------km_jobs2018 web_sms id int km_jobs2018 web_sms receiveNo varchar 接收号码 km_jobs2018 web_sms content varchar 短信内容 km_jobs2018 web_sms sendId int 发送人Id km_jobs2018 web_sms sendName varchar 发送姓名 km_jobs2018 web_sms sendDate datetime 发送时间 km_jobs2018 web_sms sendResult varchar 发送结果 km_jobs2018 web_sms sendType varchar 短信类型