十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
本篇内容介绍了“MySQL怎么查询数据库中的表名”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
我们提供的服务有:成都网站设计、成都做网站、外贸网站建设、微信公众号开发、网站优化、网站认证、胶州ssl等。为成百上千家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的胶州网站制作公司
搜索一个数据库中包含一些关键字,词的表。
SELECT TABLE_NAME FROM information_schema. TABLES WHERE table_schema = '数据库名' 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 数据库名 USE sakila; SHOW TABLES;
同上面,where条件只查数据库名。还可以同时搜索多个数据库中的表。
SELECT TABLE_NAME FROM information_schema. TABLES WHERE table_schema = '数据库名';
例:
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怎么查询数据库中的表名”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!