ComenzarEmpieza gratis

Filtering with session variables

Session variables in Snowflake let you store a value once and reference it in any query for the rest of your session using a $ prefix. They are a Snowflake-specific feature — useful for parameterising queries without hardcoding values.

The session variable $min_fee has been set to 49.99 (equivalent to running SET min_fee = 49.99). The snowy_peak.subscriptions table has columns subscription_id, user_email, plan, status, start_date, and monthly_fee.

Este ejercicio forma parte del curso

Snowflake Architecture

Ver curso

Instrucciones del ejercicio

  • Query snowy_peak.subscriptions to return plan and monthly_fee for all subscriptions where monthly_fee is greater than or equal to the session variable $min_fee.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

-- Return plan and monthly_fee for subscriptions at or above $min_fee
SELECT plan, monthly_fee
FROM snowy_peak.subscriptions
WHERE monthly_fee >= ___;
Editar y ejecutar código