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

Calculating mode (II)

In the last exercise, you created a CTE which assigned row numbers to each unique value in OrderPrice. All you need to do now is to find the OrderPrice with the highest row number.

Bu egzersiz

Intermediate SQL Server

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

Use the CTE ModePrice to return the value of OrderPrice with the highest row number.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

-- CTE from the previous exercise
WITH ModePrice (OrderPrice, UnitPriceFrequency)
AS
(
	SELECT OrderPrice,
	ROW_NUMBER() 
    OVER (PARTITION BY OrderPrice ORDER BY OrderPrice) AS UnitPriceFrequency
	FROM Orders
)

-- Select the order price from the CTE
SELECT ___ AS ModeOrderPrice
FROM ___
-- Select the maximum UnitPriceFrequency from the CTE
WHERE UnitPriceFrequency IN (___ ___(___) FROM ___)
Kodu Düzenle ve Çalıştır