Sezione 2. Capitolo 3
single
Challenge: Product Category Tree Expansion
Scorri per mostrare il menu
Compito
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).
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 2. Capitolo 3
single
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione