What is the order items table?
Mirror mirror on the wall, which is the holiest of them all? Why the order items table of course!!
Not really but I had to come up with something. :)
More details below..
The OrderItems Table
The OrderItems table stores the actual items in each order,
One row per item per order. Got that? No..?
Well, let’s try this :
let’s say a customer orders 50 units of one keyboard and 25 units of another type of keyboard.
And a second customer orders just 50 units.
Now, these are 2 separate and unique orders
The first order has 2 unique order items and the second order has a single order item.
Each order’s ‘item level details’ — are what we store in the order items table.
The order number plus the order item uniquely identify each order item.
Order number - tells us which unique order this order item belongs to. It is a link to a specific order number in the Orders table.
Order item number will be ‘1’, if only a single item was ordered.
If more than one item was ordered, it will get sequential numbering within that order.
Product ID - which keyboard was ordered? - it is a link to a specific Product_id in the Products table.
order_num and order_item are its primary keys.
There! All done and wrapped up!! That wasn’t so bad, was it?