开发者

Database design question (Book Trading System)

开发者 https://www.devze.com 2022-12-27 02:17 出处:网络
I´m developing a Book Trading System... The user will input your Book to trading... I already have a table tblBook with \"all\" existing books ...

I´m developing a Book Trading System... The user will input your Book to trading...

I already have a table tblBook with "all" existing books ... So the user will select one book from that list and fill the book´s CONDITIONS and Edition...

So, what is a good Database design to tha case?

tblBook => All books tblUserBook => All User Books

And making tblUserBook to inheritance tbl开发者_JAVA技巧Book?

Thanks


I think you're on the right track. I'd probably do something like this:

Book (book_id, book_name, etc...)

UserBook (book_id, user_id, condition, edition)

Inheritance isn't really the right word, but the UserBook table would be related to both the book and user tables and store information about that relationship.


First, I would avoid prefixes on tables such as "tbl". You should just use Books (or Book depending on your preference). What is the nature of the "conditions" and "edition" information? Is it specific to a particular book or is it specific to a user and a book together? If the former, the those should be columns in the Books table. If the later, then they should be columns in the UserBooks table.

0

精彩评论

暂无评论...
验证码 换一张
取 消