您好,欢迎访问一九零五行业门户网

mysql怎么查询表的行数

mysql查询表行数的方法:1、利用“select”语句查询指定表中的全部数据;2、使用count()函数统计查询结果的行数即可,语法为“select count(*) from table_name;”。
本教程操作环境:windows7系统、mysql8版本、dell g3电脑。
mysql查询表的行数
1.获取单表的行数
select count(*)from table_name;
2.获取多表的行数(可以使用union运算符组合每个select语句返回的结果集)
select 'tablename1' tablename, count(*) rowsfrom table_name1union select 'tablename2' tablename, count(*) rowsfrom table_name2;
3.获取某个数据库的所有表的行数(information_schema 方法有时候不准确)
use information_schema;select table_name,table_rows from tables where table_schema = 'db.name' order by table_rows desc;
【相关推荐:mysql视频教程】
以上就是mysql怎么查询表的行数的详细内容。
其它类似信息

推荐信息