MySQL 基础操作 · 二

2020-05-25  本文已影响0人  攻城狮托马斯

Union //把两种数据集合起来

SELECT City FROM Customers

UNION

SELECT City FROM Suppliers

ORDER BY City;


Group By // 由什么来分组, Having是聚合后筛选

The GROUP BY statement groups rows that have the same values into summary rows, like "find the number of customers in each country".

SELECT COUNT(CustomerID), Country

FROM Customers

GROUP BY Country;

https://www.jianshu.com/p/8b135d373df1

上一篇 下一篇

猜你喜欢

热点阅读