cte1) that selects id, drink, and a row number (rn) for each row in the CoffeeShop table.rn = 1.cte1 to itself, where the row number of the current row is one greater than the row number of the previous row.IFNULL function to replace NULL values in the drink column with the drink value from the previous row.id and drink from the final recursive CTE to get the desired output.
erDiagram
CoffeeShop {
int id PK
varchar drink
}