Review Glossary FR

Size

Eyes

Finish a part in any dojo to unlock the next eyes.

Day 17 10 min

SELECT basics

1 / 14 · ≈ 9 min left

The problem

You run the database of a small online tea shop. The person who buys the stock sends you questions all morning: what is cheap, what is out of stock, what is in the green tea range. You answer each one with a query in psql, on PostgreSQL.

The table is products (id int PRIMARY KEY, name text UNIQUE, category text, price numeric(6,2), stock int). Its 10 rows: in green, Sencha 12.50 (stock 40), Gyokuro 28.00 (0) and Jasmine Pearls 19.90 (15); in black, Earl Grey 9.50 (60), Earl Grey Cream 11.00 (25) and Assam 8.00 (0); in oolong, Tie Guan Yin 22.00 (12) and Da Hong Pao 34.00 (5); in teaware, Glass Teapot 24.50 (8) and Bamboo Whisk 15.00 (30). No two products have the same price.