If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Really simple question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-07-04, 13:42
numLocked numLocked is offline
Registered User
 
Join Date: May 2004
Posts: 9
Really simple question

Hi,
I'm kinda new to this whole database thing, so I have a pretty simple question...

I'm making a database that stores a bunch of books and information about them. I have a table for books, and a table for authors. So there is an author_id field in the books table which says which author wrote which book. But now I have a book that has multiple authors...how do I deal with that? Is there some way to have a list in of author_ids in a row? Is there a data type that will let me do this easily? The only other solution I can think of is to have a different table for every book with multiple authors, but that's obvisouly not something you want to do. Anyway, I would love some help. Thanks a lot.

-numLocked
Reply With Quote
  #2 (permalink)  
Old 06-07-04, 13:59
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,609
Three tables.

One table for books, that contains only information about the book itself.

One table for authors, with one row for every author that has ever written any part of a book you are tracking.

One table for "linkage" between them, linking a book to an author. This is also where you'd keep the "linkage specific" information such as Forward only, primary author, second, third, research assistant, etc.

-PatP
Reply With Quote
  #3 (permalink)  
Old 06-07-04, 14:01
numLocked numLocked is offline
Registered User
 
Join Date: May 2004
Posts: 9
ah! of course! i knew there was a wimple answer. thanks a lot
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On