Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Intermediate SQL Server

Cursus bekijken

Oefeninstructies

  • 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'.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

SELECT Country, 
       CASE WHEN ___ = ___  THEN ___
       ELSE ___
       END AS ___
FROM Incidents
Code bewerken en uitvoeren