#information_schema 是MySQL系统自带的数据库,提供了对数据库元数据的访问 #information_schema.tables 指数据库中的表(information_schema.columns 指列) #table_schema 指数据库的名称 #table_type 指是表的类型(base table 指基本表,不包含系统表) #table_name 指具体的表名 1、mysql中查询到包含该字段的所有表名 SELECT TABLE_NAME FROM information_schema.COLUMNS WHERE COLUMN_NAME='字段名'2、查询mysql数据库中有多少张表
select count(*) TABLES, table_schema from information_schema.tables where table_schema = 'test' group by table_schema;
3、检查数据库中的某一个表'tb_ticket'是否存在
select count(1) from information_schema.tables where table_schema = 'hdi_xcrm' and table_name = 'tb_ticket';
【mysql】查询
于 2021-11-30 14:05:17 首次发布