Get startedGet started for free

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.

This exercise is part of the course

Intermediate SQL Server

View Course

Exercise instructions

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

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

SELECT Country, 
       CASE WHEN ___ = ___  THEN ___
       ELSE ___
       END AS ___
FROM Incidents
Edit and Run Code