Comece agoraComece grátis

Como fazer agrupamentos

Neste exercício final, você deve combinar GROUP BY com funções de agregação, como MIN, que você viu anteriormente neste capítulo.

Para concluir este capítulo, vamos voltar à tabela eurovision do primeiro capítulo.

Este exercicio faz parte do curso

Introdução ao SQL Server

Ver curso

exercicio interativo prático

Tente este exercicio completando este código de exemplo.

-- 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;
Editar e Executar Código