Second-level shelves

Second-level shelves

You are a catalog analyst at a large marketplace. Product categories form a tree: every category may have a parent, root sections have none. The storefront team is redesigning the 'Electronics' section page and needs the list of its DIRECT subcategories only — grandchildren and deeper levels must not appear, they get their own pages. Table categories: id, name, parent_id (NULL for root sections). The section is named exactly 'Electronics'. Return columns: - subcategory_name — name of a direct subcategory of 'Electronics' (text, as stored). Sort by subcategory_name ascending. Categories of other sections and anything deeper than one level below 'Electronics' are excluded. Direct children have unique names.

Row order matters

PostgreSQLv16

Your query result will appear here

Focus radio
Paused · SomaFM · Fluid