分组汇总
在最后一个练习中,您将把本章前面学过的聚合函数(如 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;