Easy Explanation
Explanation:Recursive Flattening:The helper function flatten takes the current depth and the array as arguments.
If the currentDepth reaches 0, it stops flatten
# Explanation:
### Recursive Flattening:
The helper function flatten takes the current depth and the array as arguments.
If the currentDepth reaches 0, it stops flattening and returns the array as is.
### Handling Arrays and Non-Arrays:
If an element is an array, it is recursively flattened with the depth reduced by 1.
Otherwise, the element is directly added to the result.
### Concatenation:
The concat method is used to merge the results of recursive flattening into a single array.

# Code
```mysql []
# Write your MySQL query statement below
WITH FirstYearSales AS (
    SELECT
        product_id,
        MIN(year) AS first_year
    FROM
        Sales
    GROUP BY
        product_id
)
SELECT
    s.product_id,
    f.first_year,
    s.quantity,
    s.price
FROM
    Sales s
JOIN
    FirstYearSales f
ON
    s.product_id = f.product_id AND s.year = f.first_year;

```
['MySQL']