views:

47

answers:

2

Hello all!

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 tblBook?

Thanks

+1  A: 

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.

Eric Petroelje
+1  A: 

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.

Thomas