Unique Category–Supplier Pairs in the Mid Price Range

Unique Category–Supplier Pairs in the Mid Price Range

A buyer at "Kotomarket" is planning purchases and wants to know which suppliers cover which categories in the mid price range. The products table stores the shop's items: title, category, supplier, price, and stock on hand. Return the unique combinations of category and supplier (category, supplier) only for items that satisfy both conditions at the same time: - the price (price) is in the range from 500 to 2500 inclusive; - the category (category) is one of: 'мебель', 'корм', 'игрушки'. Each category–supplier pair must appear in the result exactly once (no duplicates). Sort the result by category, then by supplier (ascending). Constraints: only SELECT … WHERE … ORDER BY with DISTINCT, BETWEEN, and IN. No aggregates, GROUP BY, JOIN, subqueries, or window functions. Expected columns: category, supplier.

Exemplo de resposta esperada

É assim que se parece uma resposta correta: ela tem seu próprio número de linhas e não precisa coincidir com as tabelas do esquema. Sua resposta precisa retornar os mesmos nomes de colunas do exemplo: use AS para renomeá-las se for preciso.

categorysupplier
игрушкиИграйЛап
кормЗооМир
кормМурКорм
PostgreSQLv16
Entre para enviar

O resultado da sua consulta aparecerá aqui

Focus radio
Paused · SomaFM · Fluid