当前位置:网站首页>mysql中查询多个表中的数据量
mysql中查询多个表中的数据量
2022-08-11 09:04:00 【微生鸿朗】
查询多个表中的数据量,有两种方式进行查询。
select
table_schema as '数据库' ,
table_name as '表名' ,
table_rows as '记录数量'
FROM information_schema.tables
where TABLE_SCHEMA = 'nfds'
AND table_name in
(
'Name1' ,
'Name2' ,
'Name3'
)
另外的一个方式是
Select count(*) from name1
Union select count(*) from name2
Union select count(*) from name3
这两种方式的话是有一点不同,后面一种的话是能记录数据库中所有的数据,前一种的话是不会主动更新相关的记录,在很多情况下会让数据库中数据少。
USE [test] -- 只需修改这里的库名
SELECT a.name table_name, -- 表名
a.crdate crdate, -- 建表时间
b.rows rows, -- 总行数
8*b.reserved/1024 reserved, -- 保留大小(MB)
rtrim(8*b.dpages/1024) used, -- 已使用大小(MB)
8*(b.reserved-b.dpages)/1024 unused -- 未使用大小(MB)
FROM sysobjects AS a
INNER JOIN sysindexes AS b ON a.id = b.id
WHERE ( a.type = 'u' )
AND ( b.indid IN ( 0, 1 ) )
ORDER BY a.name,b.rows DESC;
边栏推荐
- 向日葵安装教程--向日葵远程桌面控制
- ES6:数值的扩展
- 利用mindspore下面mindzoo里面的yolov3-darknet53进行目标识别,模型训练不收敛
- eureka和consul的区别
- Detailed Explanation of the Level 5 Test Center of the Chinese Institute of Electronics (1)-string type string
- canvas图片操作
- [wxGlade learning] wxGlade environment configuration
- Kotlin算法入门求完全数
- MySql事务
- DataGrip配置OceanBase
猜你喜欢
随机推荐
mysql添加用户以及设置权限
UNITY gameobject代码中setacvtive(false)与面板中直接去掉勾 效果不一样
基于 VIVADO 的 AM 调制解调(3)仿真验证
MATLAB实战Sobel边缘检测(Edge Detection)
WordpressCMS主题开发02-制作顶部header.php和footer.php
Redis的客户端连接的可视化管理工具
Kotlin算法入门计算素数以及优化
Birth of the Go language
Typescript基本类型---下篇
四级独创的阅读词汇表
Analysis of the Status Quo of Enterprise Server Host Reinforcement
ES6:数值的扩展
golang string manipulation
Nuget找不到包的问题处理
Kotlin算法入门计算质因数
Has legal counsel become a tasteless product of law firms?
自定义卷积核的分组转置卷积如何实现?
SDUT 2877: angry_birds_again_and_again
Jupyter Notebook 插件 contrib nbextension 安装使用
工业检测深度学习方法综述