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.

Expected output sample

This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables. Your answer must use the same column names as this sample — alias them with AS if needed.

subcategory_name
Audio
Cameras
Laptops
PostgreSQLv16

Your query result will appear here

Focus radio
Paused · SomaFM · Fluid