Working out in the big city
Being one of the most popular data types in Snowflake, text data is often used within a query itself for things like CASE statements, WHERE clauses, and more!
You'll supplement a query that retrieves information about premium gym locations and classifies them as located in a major or non-major city. Keep a close eye on those text values!
Cet exercice fait partie du cours
Data Types and Functions in Snowflake
Instructions
- In the
CASEstatement, update the first value in parentheses to beNew York. - After the else keyword, add the string
Non-Major City; this is the value that will be returned if the condition above does not match. - Update the
WHEREclause to only return records with agym_typeof'Premium'.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
SELECT
gym_id,
CASE
-- Update the locations classified as a Major City
WHEN location IN ('___', 'Los Angeles', 'Dallas')
THEN 'Major City'
-- Otherwise, it's a Non-Major City
ELSE '___'
END AS gym_city
FROM CORE_GYM.gyms
-- Complete the WHERE clause to only return Premium gym types
WHERE gym_type = '___';