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

Filling missing values using ISNULL()

In the previous exercise, you practiced how to exclude and select the rows with NULL values. However, depending on the business assumptions behind your data, you may want to select all the rows with NULL values, but replacing these NULL values with another value. You can do it using ISNULL().

Now, you want to replace all the NULL values for the airport_city and airport_state columns with the word 'Unknown', using ISNULL().

Bu egzersiz

Cleaning Data in SQL Server Databases

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

Egzersiz talimatları

  • Replace the missing values for airport_city column with the 'Unknown' string.
  • Replace the missing values for airport_state column with the 'Unknown' string.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

SELECT
  airport_code,
  airport_name,
  -- Replace missing values for airport_city with 'Unknown'
  ___(___, '___') AS airport_city,
  -- Replace missing values for airport_state with 'Unknown'
  ___(___, '___') AS airport_state
FROM airports
Kodu Düzenle ve Çalıştır