始める無料で始める

グループ化して集計する

この最後の演習では、本章で学んだ MIN などの集計関数と GROUP BY を組み合わせて使います。

章の締めくくりとして、第1章で使用した eurovision テーブルに戻りましょう。

この演習はコースの一部です

SQL Server 入門

コースを見る

実践的なインタラクティブ演習

このサンプルコードを完成させて、この演習に挑戦してみましょう。

-- Retrieve the minimum and maximum place, and point values
SELECT 
  -- the lower the value the higher the place, so MIN = the highest placing
  MIN(place) AS hi_place, 
  ___(place) AS lo_place, 
  -- Retrieve the minimum and maximum points values. This time MIN = the lowest points value
  ___(points) AS min_points, 
  MAX(points) AS max_points 
FROM 
  eurovision;
コードを編集して実行