Back to problems

Find Lowest Prices for Highly Rated Categories

SQL · Capital One · Medium

We are given two relations: products and purchases. products has columns: id — integer primary key category — text, such as apple, orange, or banana product_name — text purchases has columns: id — integer primary key product_id — integer foreign key referencing products.id price — decimal with two decimal places stars — decimal with one decimal place For every category that appears anywhere in products, produce exactly one output row. If that category contains at least one…

Checking your access…