Add Stock Value
Part of the First Queries section of Coddy's PostgreSQL journey. Lesson 17 of 20.
Challenge
MediumExtend the shortlist. Keep products priced below 25 with positive stock, keep id, name and price, and add inventory_value as price times stock. Keep the same price and id ordering.
The input tables are shown in the test panel. Each run starts from fresh data. Return the named columns in the stated order; do not hard-code the displayed rows.
Try it yourself
SELECT id, name, price FROM products WHERE price < 25 AND stock > 0 ORDER BY price, id;All lessons in First Queries
Practice on your own: PostgreSQL playground