BaşlayınÜcretsiz başlayın

Numbering Olympic games in descending order

You've already numbered the rows in the Summer Medals dataset. What if you need to reverse the row numbers so that the most recent Olympic games' rows have a lower number?

Bu egzersiz, kursun bir parçasıdır

PostgreSQL Summary Stats and Window Functions

Kursa Göz Atın

Egzersiz talimatları

  • Assign a number to each year in which Summer Olympic games were held so that rows with the most recent years have lower row numbers.

Uygulamalı etkileşimli egzersiz

Bu egzersizi bu örnek kodu tamamlayarak deneyin.

SELECT
  Year,
  -- Assign the lowest numbers to the most recent years
  ___ OVER (___) AS Row_N
FROM (
  SELECT DISTINCT Year
  FROM Summer_Medals
) AS Years
ORDER BY Year;
Kodu Düzenle ve Çalıştır