I am going to create a bookstore in which we have 3 objects (classes): Seller, Buyer, Book. I developed the database as follows:
- Both the buyer and the seller can buy / sell one or more books, respectively.
The buyer needs a seller account if he wants to sell the book.
- Buyers will bid, and the seller would like to sell to the best buyer, and I must save all the information among them.
In this model the process class will be the other three classes connector:
seller book buyer
------- ------ -------
sID * bID * byID *
name -> sID
This was my first thought & then I found out that this schema will fail in the process due to a buyer could buy multiple books at the same time and there were other reasons, too. so I changed it:
In this model the process class will be the other three classes connector:
______ ______ ________ _______
| seller | | book | | process | | buyer |
-------- -------- ---------- ---------
| sID * | | bID * | | pID * | | byID * |
| name | | XXX | -> | sID | | date & .. |
----------
(*) indicates a primary key
this will work better I think, but how to get into work with Price offers ?
yes, I can add a offer to the process class, so I've changed my mind & this model came into the place: (sorry for long description)
The * Offer * field will be added to the * process * class: ______ ______ _________ _______ | seller | | book | | process | | buyer | -------- -------- ----------- --------- | sID * | | bID * | | pID * | | byID * | | name | | XXX | -> | sID | | offer | | date & .. | ----------- (*) indicates a primary keyI am completely confused with db design because of this for the first time. Will this satisfy the needs of the system? If not, how can I make it work? If so, is there a better design?
Any suggestion is appreciated, thanks in advance :)
update - , . . , ^ o ^
user80276