Write a tax function with an optional rate (catering)
Define Gross(net, optional rate) that uses 20% when no rate is given, and apply it to every order.
- Level
- intermediate
- Time
- ~9 min
- Task
- Build the query
- Access
- Pro
Checking your access…
About this exercise
What you'll practise
Declare an optional parameter and give it a default inside the function.
The scenario, sample data, step list, hints and solution open with Pro. Grading checks your query against hidden data as well as the visible sample, so a query that only fits the sample doesn't pass.
Input
- Orders (table)
- OrderID: text
- Net: number
- Rate: number (nullable)
Expected output columns
OrderID (text), Net (number), Rate (number (some rows null)), Gross (number)