No code, but it seems this is more a database schema issue than anything else.
It looks like you know how to construct databases, tables, and insert data. So, you just need to understand how to put that data into the database (how to structure the database) for easy storage and retrieval.
You'll have at least 4 tables: Customers, Items, LineItems, and Orders.
Customers is self-explanatory.
Each Order will have its own OrderID and be a record containing at least the Customer ID and DateAndTime.
Each LineItem will have its own LineItemID, and will have a reference to the OrderID of which it pertains and the relevant ItemID. You'd probably want to store price, discount, etc. for that particular item for that particular order.
If that doesn't make sense, then I hope somebody comes along with some relevant code for you! Otherwise, you get to do some research into optimal database schemas!