MySQL中 如何查詢表名中包含某字段的表

2021-09-02 13:29:29 字數 977 閱讀 5872

select table_name from information_schema.tables where table_schema='tablename' and table_type='base table' and table_name like '%_copy';

information_schema 是mysql系統自帶的資料庫,提供了對資料庫元資料的訪問

information_schema.tables 指資料庫中的表(information_schema.columns 指列)

table_schema 指資料庫的名稱

table_type 指是表的型別(base table 指基本表,不包含系統表)

table_name 指具體的表名

如果本身是在tablename 這個庫里新建的查詢,可以去掉 table_schema='tablename ' 這一句

select table_name from information_schema.tables where table_type='base table' and table_name like '%_copy';

select * from systables where tabname like 'saa%'

此法只對informix資料庫有用

select column_name from information_schema.columns where table_schema='csdb' and table_name='***'

select count(1) from information_schema.tables where table_schema = 'test' and table_name = 'd_ad';

select count(*) tables, table_schema from information_schema.tables where table_schema = 'test' group by table_schema;

MySQL中 如何查詢表名中包含某字段的表

select table name from information schema.tables where table schema tablename and table type base table and table name like copy information schema 是m...

MySQL中 如何查詢表名中包含某字段的表

select table name from information schema.tables where table schema tablename and table type base table and table name like copy information schema 是m...

MySQL中 如何查詢表名中包含某字段的表

select table name from information schema.tables where table schema tablename and table type base table and table name like copy information schema 是m...