im new to database design and im trying to create an ERD for a pharmacy that sells products online and also accepts repeat prescriptions orders to customers.
Here is the link to my ERD:
https://i.stack.imgur.com/vmeOD.png
I’m wondering how i could only make use of only one ‘payment’ and ‘card details’ entity for both orders, so have i have 2 entities for each order. Would i be able to make a relationship between the ORDER TYPE entity and payment/card details entity.
Any help would be appreciated. thanks
I’m trying to find a good reason forh aving both
Prescription_OrderandProduct_Order. There should just be anOrders(pluralized because ORDER is a reserved word everywhere) table, where theCustomer_Recurring_Ordertable (with a natural key of references toCustomerandProduct) breaks out the rules for a customer’s recurring orders, regardless of whether they are prescription in nature or not. Your medicine attribute properly belongs as a record in the product table.Also, the
Card Detailstable should properly be linked to one or moreCustomer, as I’m pretty sure that card details are functionally dependent on the existence of a customer.Once you’ve cleaned those up, you only need one
PaymentorCard Detailsentity. A good design principle to remember is that if two entities have all the same attributes, they probably aren’t two different entities.Why didn’t you break out shipping information into a separate entity,
Order_Shipment. Will all shipments always contain all portions of a customer’s order?