51Testing软件测试论坛

标题: 在products表中,有product_id、product_name和category列,写一个查询获取每个类... [打印本页]

作者: 测试积点老人    时间: 2024-11-7 09:43
标题: 在products表中,有product_id、product_name和category列,写一个查询获取每个类...
在products表中,有product_id、product_name和category列,写一个查询获取每个类别(category)下的产品数量。


作者: kallinr    时间: 2024-11-8 09:17
SELECT category, COUNT(*) AS product_count
FROM products
GROUP BY category;
作者: oliver.tang    时间: 2024-11-8 09:17
select count(product_id) from products group by category
作者: 海海豚    时间: 2024-11-8 10:54
SELECT category, COUNT(*) AS product_count
FROM products
GROUP BY category;
作者: jingzizx    时间: 2024-11-8 11:28
SELECT category, COUNT(*) AS product_count
FROM products
GROUP BY category;
作者: 你好浮戈    时间: 2024-11-8 13:14
SELECT category, COUNT(*) AS product_count
FROM products
GROUP BY category;
作者: litingting0214    时间: 2024-11-8 13:53
select count(product_id) from products group by category




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2