Seksjon 2. Kapittel 3
single
Challenge: Product Category Tree Expansion
Sveip for å vise menyen
Oppgave
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).
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 2. Kapittel 3
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår