时间:2021-07-01 10:21:17 帮助过:35人阅读
执行结果
使用union组合每个select查询的结果集
例如,要在单个查询中获取customers
和orders
表的行数
1 SELECT 2 ‘customers‘ tablename, 3 COUNT(1) rows 4 FROM 5 customers 6 UNION 7 SELECT 8 ‘orders‘ tablename, 9 COUNT(1) rows 10 FROM 11 orders;
运行结果
1 SELECT 2 table_name, 3 table_rows 4 FROM 5 information_schema.tables 6 WHERE 7 table_schema = ‘dbname‘ 8 ORDER BY table_rows desc;
运行结果
mysql获取表中数据行数
标签:row class com order sel border 查询 alt info