找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索本站精品资源

首页 教程频道 查看内容

mysql怎样查询表的个数

作者:模板之家 2022-5-16 19:17 111人关注

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

在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;

06.png

推荐学习:mysql视频教程

以上就是mysql怎样查询表的个数的详细内容,更多请关注模板之家(www.mb5.com.cn)其它相关文章!


路过

雷人

握手

鲜花

鸡蛋
来自: 网络收集

全部回复(0)