Answer the question
In order to leave comments, you need to log in
Have I drawn the online store database schema correctly?
I'm new to drawing database schemas, any advice would be greatly appreciated.
How would it be correct to link the table in which all purchased goods are stored (Order Log)?
Thanks
Answer the question
In order to leave comments, you need to log in
The first thing that catches your eye:
1. You have only 1st level categories, will there be no nested categories?
2. What is the "Product Type" in the "Category" table? and what does it affect?
1. The rest of the goods are not stored anywhere. It's unlikely that a store sells a product that never runs out...
2. It's very bad practice to store the number of product views (which must be constantly updated) in the product table .
1. What should be stored in the shopping cart? contents of an already placed order? Then here you need to take into account the quantity of the ordered goods and its cost at the time of the order (after all, it changes over time) What is the composition of the order being formed? Then you need to take into account at least the amount of added goods. Both?
2. In fact, you now have a list of goods added by the user in the basket, then why store the "client's IP" in each line? As far as I understand, you use IP to link the basket to the client - in this case, you do not need to store it in each position of the basket, it is better to enter a separate table for these purposes, and linking the basket by IP is a bad option
1. The order amount is not stored anywhere, Do you plan to calculate it "on the fly"?
2. It's not clear what purpose the "Order log" table has.
3. You store customer data in an order, but what happens if the same customer places several orders? You will get data duplication, so you should put information about customers in a separate table
PS The correctness of the database structure is difficult to assess by one scheme. In this matter, it is necessary to proceed from the tasks that are planned to be solved.
Link the basket to the session and yours to the ip, store the order positions in a separate table - this will save you from problems with renaming products and categories ... In general, your scheme will work, but this is a nursery shop))) no offense
You don't have users as such. And someone may want to become a regular customer and not enter the delivery address and full name 10 times.
The basket and the order you have are 2 entities, partly duplicating, partly competing. Maybe it's easier to make one entity - Order, but with different statuses? In the initial stage, it will be a basket. And what is now called a basket will simply be a list of goods in the order.
There is no quantity of goods in the basket, and this is important. Products have sizes, colors and other attributes, this must also be taken into account.
Then there are tariffs, taxation, and so on.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question