解答

122

SQL文(クエリ)

SELECT
  CASE
    WHEN cost <= 300 THEN "a.300以下"
    WHEN cost <= 600 THEN "b.301-600"
    WHEN cost <= 900 THEN "c.601-900"
    ELSE "d.901以上"
  END AS cost_category
  , COUNT(*) AS number_of_products
FROM
  sample.products
GROUP BY
  cost_category
ORDER BY
  1

結果テーブル

結果テーブル

サポートページに戻る