Week 46 - SQL & Query Techniques
We're going to give you something old and something new for this challenge (sadly not borrowed or blue).
We're taking a look at the new Array functions released in the last release and also looking into Recursive CTEs!
The challenge is a 2-parter ;
Part #1
Create a table that looks like this using purely snowflake-based functions:
| Cart_number | Contents |
| 1 | [5,10,15,20] |
| 2 | [8,9,10,11,12,13,14] |
Part #2:
Use the following table to 'unpack' your cart :
| Cart_number | Content_to_remove | Order_to_remove_in |
| 1 | 10 | 1 |
| 1 | 15 | 2 |
| 1 | 5 | 3 |
| 1 | 20 | 4 |
| 2 | 8 | 1 |
| 2 | 14 | 2 |
| 2 | 11 | 3 |
| 2 | 12 | 4 |
| 2 | 9 | 5 |
| 2 | 10 | 6 |
| 2 | 13 | 7 |
your answer should create a table with the following columns :
- Cart_number
- Current_contents_of_cart
- content_last_removed
good luck unpacking!