Choose columns when one of them is optional (kite shop)
Some exports include a Notes column and some don't. Keep the same four columns either way.
- Level
- intermediate
- Time
- ~7 min
- Task
- Build the query
- Access
- Free — no account needed
Loading the practice workspace…
About this exercise
What you'll practise
Use Choose Columns with a missing-field option so an optional column can't break refresh.
Northwind Kites sells kites and accessories through three regional stores. Orders are exported from the till system every week.
Steps
- Keep
OrderID,Customer,QtyandNotes. - Some weeks the export has no
Notescolumn. Then the query must still run and return aNotescolumn filled with null.
Your result must
- Columns: OrderID, Customer, Qty, Notes
- Works when Notes is missing
- Notes is null when the export didn't include it
Input
- Orders (table)
- OrderID: text
- Customer: text
- Region: text
- Product: text
- Qty: number
- UnitPrice: number
- OrderDate: text
- Status: text
- Notes: text
Expected output columns
OrderID (text), Customer (text), Qty (number), Notes (text)
| OrderID | Customer | Qty | Notes |
|---|---|---|---|
| 0001 | Esi Brandt | 5 | |
| 0002 | Tariq Rahman | 6 | Gift wrap |
| 0003 | Rosa Eklund | 8 | Leave at door |