Week 138 – SQL & Query Techniques

Nulls Behaving Badly

Ever wondered how Snowflake decides where to place NULL values when you sort your data? 🤔 Let’s dive into the DEFAULT_NULL_ORDERING parameter and see how it influences the ordering of NULLs in your queries.

Challenge Overview

Your task is to:

  1. Set the DEFAULT_NULL_ORDERING parameter to both 'FIRST' and 'LAST' in your session.
  2. Create a sample table with a mix of NULL and non-NULL values.
  3. Observe the ordering of NULLs in your query results under different settings.
  4. Override the default behavior using explicit NULLS FIRST or NULLS LAST in your ORDER BY clause.
  5. Bonus: Retrieve the current setting of DEFAULT_NULL_ORDERING using a SQL query.



Good luck, and stay frosty! ❄️

Previous
Previous

Week 139 - Cortex (AI / ML)

Next
Next

Week 137 - Data Quality & Monitoring