测试积点老人 发表于 2024-11-7 09:45:42

从customers表(包含customer_id、customer_name、city)中查询出每个城市(city)...

从customers表(包含customer_id、customer_name、city)中查询出每个城市(city)的客户数量,并按照客户数量降序排列。
**** Hidden Message *****

kallinr 发表于 2024-11-8 09:18:01

SELECT city, COUNT(*) AS customer_count
FROM customers
GROUP BY city
ORDER BY customer_count DESC;

oliver.tang 发表于 2024-11-8 09:18:19

order by

海海豚 发表于 2024-11-8 10:54:11

SELECT city, COUNT(*) AS customer_count
FROM customers
GROUP BY city
ORDER BY customer_count DESC;

jingzizx 发表于 2024-11-8 11:29:33

SELECT city, COUNT(*) AS customer_count
FROM customers
GROUP BY city
ORDER BY customer_count DESC;

你好浮戈 发表于 2024-11-8 13:14:40

SELECT city, COUNT(*) AS customer_count
FROM customers
GROUP BY city
ORDER BY customer_count DESC;

litingting0214 发表于 2024-11-8 13:54:00

SELECT city, COUNT(*) AS customer_count
FROM customers
GROUP BY city
ORDER BY customer_count DESC;
页: [1]
查看完整版本: 从customers表(包含customer_id、customer_name、city)中查询出每个城市(city)...