1、查询当前数据库
# 查询当前数据库
select database();
2、查询当前数据库所有表
# 查询当前数据中所有表
select table_name tableName,engine ,table_comment tableComment, create_time createTime
from information_schema.tables
where table_schema = (select database())
order by create_time desc;
3、查询当前表所有字段
# 查询表中字段
select column_name columnName, data_type dataType, column_comment columnComment, column_key columnKey, extra from information_schema.columns
where table_name = "pms_attr" and table_schema = (select database()) order by ordinal_position;