SQL A table Products have: a name (TEXT) a description (TEXT) a unit cost stored in cents (INTEGER) and of course we also add an id column to identify them. Separately, we'd like to track the number of items in stock for each product. To do so we'll have a store and an inventory table. Stores have just an id and a name. Then, our inventory table should combine stores and products, listing how much of each product each store has in stock. a product_id (INTEGER) a store_id (INTEGER) a quantity (INTEGER) in stock Now we can insert some stores, products and inventory into our database. There are 2 stores -- one called NY and one called NJ. There are 2 products we are concerned with. Their names are sneakers, costing $220 (remember this is dollars!) and boots costing $350. Use any description for each that you'd like. NY has 4 sneakers in stock and 3 boots. NJ has 5 sneakers in stock and no boots. Insert the above data into the tables you have created.
SQL
A table Products have:
- a name (TEXT)
- a description (TEXT)
- a unit cost stored in cents (INTEGER)
and of course we also add an id column to identify them.
Separately, we'd like to track the number of items in stock for each product.
To do so we'll have a store and an inventory table.
Stores have just an id and a name. Then, our inventory table should combine stores and products, listing how much of each product each store has in stock.
- a product_id (INTEGER)
- a store_id (INTEGER)
- a quantity (INTEGER) in stock
Now we can insert some stores, products and inventory into our
There are 2 stores -- one called NY and one called NJ. There are 2 products we are concerned with. Their names are sneakers, costing $220 (remember this is dollars!) and boots costing $350. Use any description for each that you'd like. NY has 4 sneakers in stock and 3 boots. NJ has 5 sneakers in stock and no boots.
Insert the above data into the tables you have created.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images