Sectie 2. Hoofdstuk 3
single
Challenge: Product Category Tree Expansion
Veeg om het menu te tonen
Taak
Swipe to start coding
Create a recursive CTE to list all subcategories under the "Electronics" category in the product_categories table, displaying each category's depth in the hierarchy.
- Use a recursive CTE to traverse the product category hierarchy starting from the "Electronics" category.
- For each category, include its
category_id,category_name,parent_category_id, and the hierarchydepth. - The root category ("Electronics") should have a depth of 1.
- Each direct child should have a depth of 2, their children a depth of 3, and so on.
- Only include categories that are descendants of "Electronics" (including "Electronics" itself).
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 2. Hoofdstuk 3
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.