Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Base structure question 1

Status
Not open for further replies.

byleth

Programmer
Feb 27, 2004
70
PT
Hi,

i don't know if this is the right place to put this question, but i'll put it anyway..

how do i manage the problem of having a situation in wich i don't know in advance how many fields will be required?

For example,

In the process of structuring the book DB i don't know in advance how many authors a book may have... should i create fields like 'Author1', 'Author2', etc, hoping not to find a book written by 4 or 5 authors? Is there another, more efficient solution?


Thanks
 
Create an 'authors' table a 'book' table and 'authorlookup' table. The 'authorlookup' table will only hold foreign keys to the other two tables (two fields, you could add a third for a primary author flag). This way you can have multiple authors on a book and use the same author(s) for more than one book. When you update the author information it will be updated for all books.

Books: ID, Name, etc., etc...
Authors: ID, Name, etc., etc...
AuthorLookup: BookID, AuthorID, [Primary]

For general database discussion join forum669 as well.

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top