本篇內(nèi)容介紹了“MySQL怎么查詢數(shù)據(jù)庫(kù)中的表名”的有關(guān)知識(shí),在實(shí)際案例的操作過程中,不少人都會(huì)遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
我們提供的服務(wù)有:成都網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站、外貿(mào)網(wǎng)站建設(shè)、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、膠州ssl等。為成百上千家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的膠州網(wǎng)站制作公司
搜索一個(gè)數(shù)據(jù)庫(kù)中包含一些關(guān)鍵字,詞的表。
SELECT TABLE_NAME FROM information_schema. TABLES WHERE table_schema = '數(shù)據(jù)庫(kù)名' AND TABLE_NAME LIKE '%name%';
例:
mysql> select table_name from information_schema.tables -> where table_schema = 'sakila' -> and table_name like "%film%"; +----------------------------+ | TABLE_NAME | +----------------------------+ | film | | film_actor | | film_category | | film_list | | film_text | | nicer_but_slower_film_list | | sales_by_film_category | +----------------------------+ 7 rows in set (0.00 sec)
show tables; -- use 數(shù)據(jù)庫(kù)名 USE sakila; SHOW TABLES;
同上面,where條件只查數(shù)據(jù)庫(kù)名。還可以同時(shí)搜索多個(gè)數(shù)據(jù)庫(kù)中的表。
SELECT TABLE_NAME FROM information_schema. TABLES WHERE table_schema = '數(shù)據(jù)庫(kù)名';
例:
mysql> select table_name from information_schema.tables where table_schema = 'sakila'; +----------------------------+ | TABLE_NAME | +----------------------------+ | actor | | actor_info | | address | | category | | city | | country | | customer | | customer_list | | film | | film_actor | | film_category | | film_list | | film_text | | inventory | | language | | nicer_but_slower_film_list | | payment | | rental | | sales_by_film_category | | sales_by_store | | staff | | staff_list | | store | +----------------------------+ 23 rows in set (0.00 sec) mysql> select table_name from information_schema.tables where table_schema = 'sakila' or table_schema = 'test'; +----------------------------+ | TABLE_NAME | +----------------------------+ | actor | | address | | category | | city | | country | | customer | | film | | film_actor | | film_category | | film_text | | inventory | | language | | payment | | rental | | staff | | store | | customer_list | | film_list | | nicer_but_slower_film_list | | staff_list | | sales_by_store | | sales_by_film_category | | actor_info | | employee | | test_alter | +----------------------------+ 25 rows in set (0.01 sec)
“mysql怎么查詢數(shù)據(jù)庫(kù)中的表名”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!