在mysql中,可以利用SELECT语句配合count()函数查询数据库中表的个数,语法为“SELECT count() FROM information_schema.TABLES WHERE TABLE_SCHEMA='数据库名';”。

本教程操作环境:windows10系统、mysql8.0.22版本、Dell G3电脑。
mysql怎样查询表的个数
查看数据库表数量
语法如下:
SELECT count(TABLE_NAME) FROM information_schema.TABLES WHERE TABLE_SCHEMA='dbname';其中dbname是要查看的数据库的名字。
查看表结构:
description tbname;也可使用简写:
desc tbname;示例如下:
select count(*) tables ,table_schema from information_schema.tables where table_schema='work_ad' group by table_schema;

以上就是mysql怎样查询表的个数的详细内容,转载自php中文网

发表评论 取消回复