Forbid products with a negative price
After the third bug accounting asked: «let the database itself reject products priced at or below zero» — it's more reliable than validating in application code.
Build products with id (primary key), name (up to 100 chars), and price (number with two decimals), then add a constraint products_price_positive that forbids rows with price ≤ 0. After that any attempt to insert a row with zero or negative price fails with an error.
Just CREATE/ALTER/DROP — no trailing SELECT needed.
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inNo starting schema
This task starts with no tables — you'll create them via CREATE TABLE.
Focus radio
Paused · SomaFM · Fluid