MulaiMulai sekarang secara gratis

Using CASE statements

In this exercise, you will use a CASE statement to create a new column which specifies whether the Country is USA or International.

Latihan ini adalah bagian dari kursus

Intermediate SQL Server

Lihat Kursus

Petunjuk latihan

  • Create a new column, SourceCountry, defined from these cases:
    • When Country is 'us' then it takes the value 'USA'.
    • Otherwise it takes the value 'International'.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

SELECT Country, 
       CASE WHEN ___ = ___  THEN ___
       ELSE ___
       END AS ___
FROM Incidents
Edit dan Jalankan Kode