mahir_data
hardLazada · windowPro

Second most expensive product per category

Lazada wants the runner-up priced item in each category.

For each category in products, return the category and the second highest price in that category as second_highest. Assume no two products in a category share the same price.

Schema

products
idINT
categoryTEXT
priceNUMERIC(10,2)

Pro

The example input, expected output, and walkthrough for this question unlock with a Pro plan.

Pro

This is a Pro question

Premium practice questions unlock with a Pro plan. The full solution, expected output, and grading are available to Pro members.

See Pro plans