简体   繁体   中英

Database model for customer order

I am creating an ordering system for a journal. I'm not sure how to go about creating the correct relationships for the actual order.

The subscribers will be able to purchase single issues or annual issues. The annual issues are made up of 3 single issues. The subscriber will also be able to purchase single articles.

I currently have an intermediary table FK to the subscriber and the FK to the article, issue and annual table.

Is there a better way to do this kind of setup. Should there be a looser coupling with an inventory table that would make more sense?

I would not have a foreign key from article to subscriber. I think an order table would be a better idea. A subscriber could have many orders; an order could consist of a single issue or an annual subscription.

There'd be a foreign key from order to subscriber, maybe an order_item with a foreign key to order and another to what is being purchased.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM