Brightlane's merchandising team is building a master price list ahead of the Q4 catalog refresh.
Write a query to return every product's ID, name, and price.
Assumptions:
- The
productstable contains every item in Brightlane's catalog. - Each product has an
id, aname, and apricerecorded.
Output:
- One row per product, with columns
id,name, andprice.
Schema · ecommerce 5 tables
Run previews · Check grades
Write a query, then run it to see results here.
Worked solution Try it yourself first
SELECT
id,
name,
price
FROM
products The shape
FROM products points the query at the catalog table, and the three named columns in the SELECT list shape every row into the exact slice the merchandising team needs.
Clause by clause
SELECT id, name, pricenames the three columns to return, in that order. The master price list lands withidon the left,namein the middle, andpriceon the right — exactly the column layout the prompt asks for.FROM productsis the row source. PostgreSQL reads every row from theproductstable and hands the full population to theSELECTlist. With noWHERE, every row in the catalog survives — Apex Titan 15 at $999, Vega S24 Ultra at $899, and on through the full inventory.
Why this and not SELECT *
SELECT * would also return the catalog, but with every column the products table happens to carry — category IDs, stock levels, anything else the schema includes. The refresh only needs three. Naming them keeps the result stable: if a new column gets added to products next quarter, this query still returns the same three. A SELECT * query would silently start returning the new column too, which is the kind of drift that breaks downstream consumers.
You practiced reading rows from a single table by naming it in FROM and listing the columns you want in SELECT. The SELECT … FROM skeleton is the foundation for every query you'll write in SQL.