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

2021-09-26 10:00:15 字數 1725 閱讀 3466

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 指具體的表名

查詢work_ad資料庫中是否存在包含"user"關鍵字的資料表

select table_name from information_schema.tables where table_schema =

'work_ad

'and table_type=

'base table

'and table_name like

'%user%

';

如果本身是在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.columns  where  column_name=

'欄位名

'

如:查詢包含status 欄位的資料表名

select table_name from information_schema.columns where column_name=

'status

';

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...