测试积点老人 发表于 2024-11-7 09:43:41

在products表中,有product_id、product_name和category列,写一个查询获取每个类...

在products表中,有product_id、product_name和category列,写一个查询获取每个类别(category)下的产品数量。
**** Hidden Message *****

kallinr 发表于 2024-11-8 09:17:40

SELECT category, COUNT(*) AS product_count
FROM products
GROUP BY category;

oliver.tang 发表于 2024-11-8 09:17:46

select count(product_id) from products group by category

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

SELECT category, COUNT(*) AS product_count
FROM products
GROUP BY category;

jingzizx 发表于 2024-11-8 11:28:23

SELECT category, COUNT(*) AS product_count
FROM products
GROUP BY category;

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

SELECT category, COUNT(*) AS product_count
FROM products
GROUP BY category;

litingting0214 发表于 2024-11-8 13:53:43

select count(product_id) from products group by category
页: [1]
查看完整版本: 在products表中,有product_id、product_name和category列,写一个查询获取每个类...