新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
MySQL關(guān)于查找模式對象的語句
在日常工作中,搜索特定的數(shù)據(jù)庫對象,是最常見的一個工作,下面分享幾個關(guān)于mysql模式查找的語句。

成都創(chuàng)新互聯(lián)公司成都網(wǎng)站建設(shè)按需定制制作,是成都網(wǎng)站推廣公司,為iso認(rèn)證提供網(wǎng)站建設(shè)服務(wù),有成熟的網(wǎng)站定制合作流程,提供網(wǎng)站定制設(shè)計服務(wù):原型圖制作、網(wǎng)站創(chuàng)意設(shè)計、前端HTML5制作、后臺程序開發(fā)等。成都網(wǎng)站營銷推廣熱線:028-86922220
1. 在 MySQL 數(shù)據(jù)庫中查找名稱中包含數(shù)字的表
select table_schema as database_name,
table_name
from information_schema.tables
where table_type = 'BASE TABLE'
and table_name rlike ('[0-9]')
order by table_schema,
table_name;
說明:
- database_name - 找到表的數(shù)據(jù)庫(模式)的名稱
- table_name - 找到的表的名稱
2. 在 MySQL 數(shù)據(jù)庫中查找關(guān)于特定列名的表
select tab.table_schema as database_name,
tab.table_name
from information_schema.tables as tab
inner join information_schema.columns as col
on col.table_schema = tab.table_schema
and col.table_name = tab.table_name
where tab.table_type = 'BASE TABLE'
and column_name = 'idcity'
order by tab.table_schema,
tab.table_name;
說明:
- database_name - 找到表的數(shù)據(jù)庫(模式)的名稱
- table_name - 找到的表的名稱
3. 在 MySQL 數(shù)據(jù)庫中查找沒有特定名稱的列的表
select tab.table_schema as database_name,
tab.table_name
from information_schema.tables tab
left join information_schema.columns col
on tab.table_schema = col.table_schema
and tab.table_name = col.table_name
and col.column_name = 'id' -- put column name here
where tab.table_schema not in ('information_schema', 'mysql',
'performance_schema', 'sys')
and tab.table_type = 'BASE TABLE'
and col.column_name is null
order by tab.table_schema,
tab.table_name;
說明:
- database_name - 找到的表的數(shù)據(jù)庫(模式)名稱
- table_name - 找到的表的名稱?
本文題目:MySQL關(guān)于查找模式對象的語句
文章位置:http://fisionsoft.com.cn/article/dpeihsj.html


咨詢
建站咨詢
