Menu
CoddyTech

Stock Decision

Part of the First Queries section of Coddy's PostgreSQL journey. Lesson 20 of 20.

challenge icon

Challenge

Medium

Return id, name, stock_value and decision for all products. stock_value is price times stock. decision is reorder for zero stock, review for positive stock below 4, and keep otherwise. Order by stock_value descending, then id.

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

-- Write your SQL here.

All lessons in First Queries

Practice on your own: PostgreSQL playground