Project: the price list
SQL · Unit 1: First queries
- Free
- SQL
- Project
- 3 exercises
Another store wants to buy from this one by the box, 10 units to a box. It asks for a list with each product's unit price and its price per box.
The first thing is to try the calculation with a price you know. The Keyboard costs 45.5.
SELECT 45.5 * 10 AS per_box;Returns
| per_box |
|---|
| 455 |
Exercises in this lesson
You do them in the app, which checks them on the spot and explains why.
1. Put the lines in order
"Keyboard (Accessories)" is the kind of sign every box gets, the product and then its category. Put in order the query that builds them. One line doesn't belong.
2. Write the code
Write the price list. For each product, show three columns, in this order: its
name, itsprice, and the price of a box of 10. Give the third one the aliasper_box.SELECT name, price FROM products;3. Write the code
Before promising boxes, the owner wants to know if there's enough. For each product, show three columns, in this order: its
name, itsstock, and how much would be left after selling a box of 10, with the aliaswould_remain.SELECT name, stock FROM products;
It opens in your browser. It is free and you do not need an account to start.