Kotomarket showcase: price tiers and the top 5

Kotomarket showcase: price tiers and the top 5

The "Kotomarket" marketplace catalog has a flat products table of cat goods: id, name, category, price (rubles), in_stock (units on hand). The marketing team is building a "Best deals" showcase and asks you to assemble it with a single SELECT query. Showcase requirements: 1. Price tier. Every product gets a price_tier column: products cheaper than 500 ₽ — 'бюджет', from 500 ₽ up to (not including) 1500 ₽ — 'средний', 1500 ₽ and above — 'премиум'. 2. Product selection. Only products that are in stock make the showcase. Of those, marketing wants the ones in the корм or игрушки category, plus — regardless of category — anything cheaper than 500 ₽. 3. Order. Most expensive first; products with equal prices are ordered by name alphabetically. 4. Size. The showcase holds only the first 5 rows of the selection. Output the columns in this order: name, category, price, price_tier. Row order matters (it is defined by the sort).

A ordem das linhas importa

PostgreSQLv16
Entre para enviar

O resultado da sua consulta aparecerá aqui

Focus radio
Paused · SomaFM · Fluid