Get startedGet started for free

Creating and Calling a SQL UDF

Harbr's operations team wants a consistent way to label shipment performance across all regions - rather than repeating a CASE statement in every query, you'll package the logic into a reusable scalar UDF. Your task is to create a UDF that takes delivery_days as input and returns a performance tier label, then apply it against logistics.shipments to identify how many shipments fall into each tier.

⚠️ Can't select a database, or getting a "table not found" error?

Use the table's full path in your FROM clause. Get it from the left panel: Databases tab → expand your COURSE_… database → select the table → Copy name.

This exercise is part of the course

Data Pipeline Automation in Snowflake

View Course

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise