查看分区数据量,查看全库数据量 USE information_schema; SELECT PARTITION_NAME,TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 'sale_data'; SELECT table_name,table_rows FROM TABLES WHERE TABLE_SCHEMA = 'db_name' ORDER BY table_rows DESC ; http://my…
进行数据库测试时需要根据不同场景查询数据,以便验证发现的问题是否为脏数据引起的.记录一下最近常用的查询方法: 1. 查询表中重复数据(id不同,多个字段值相同) select P1.* from project as P1, project as P2 where P1.id<>P2.id and P1.ProjectId=P2.ProjectId and P1.ServiceTypeId=P2.ServiceTypeId and P1.Rank=P2.Rank 2.连接多个表数据 selec…