时间:2021-07-01 10:21:17 帮助过:4人阅读
查看所有数据库中所有基本表的数据库名和表名
SELECT `TABLES`.`TABLE_SCHEMA`, `TABLES`.`TABLE_NAME` FROM `information_schema`.`TABLES` WHERE `TABLES`.`TABLE_TYPE` = ‘base table‘;
查看test1数据库中t1表中的所有列信息
其中order by `ORDINAL_POSITION`指按照表中原有列的顺序
SELECT * FROM `information_schema`.`COLUMNS` where `TABLE_SCHEMA`=‘test1‘ and `TABLE_NAME`=‘t1‘ order by `ORDINAL_POSITION`;
查看test1数据库所有表中的表名称和列名
SELECT DISTINCT TABLE_NAME,COLUMN_NAME FROM `information_schema`.`COLUMNS` where `TABLE_SCHEMA`=‘test1‘;
mysql查看表中列信息
标签: