being a newbie to mysql, I'm a little confused about how to deal with the following: I am creating a database of books and have come down to this - table for books (books) including fields for id (primary key, auto-incr.) title author (could be 2 or more) category (could be several - eg. youth, fiction, comics, and history, for same book) lang (eng, french, spanish, or german) descr (short summary, if avail.) comment (review(s)) publisher pub_link (publisher's web addr. if avail.) bk_cover (image, if avail.) publish_date ISBN buy_link (if avail.)
The other tables would be authors, categories, and buy_links. My problem is how to deal with several authors, categories, and links to sellers. What do I enter in the author field when I have several authors? Do I set up references to the author's name(s) in another table, like (3, 7, 23) each number representing the name of an author in another table? That is, .e.g. a number_id is entered in the author field in the books table; in the author table, I enter John Smith in the author_id field in the author table? Is the field for the author_id a foreign key? Same question for categories... buy_link - there are not many, but generally include an image and related info to be shown next to the books info (here, I suppose, just a few numbers will suffice to reference the table containing the information) and this field (buy_link_id) would be a foreign key (?) referencing the buy_link table? So, in a query (search) I would be doing joins from the books table to the author, category, and buy_link tables using foreign keys? But how do I deal with a search for a book by author? If there are, say, 3 authors (Red, White, and Blue) and the search is for White, the display should probably be formulated with a php function to display the book listing by book title (the standard display which includes all the relevant information about the book). So the search should first find the name of the author in the authors table and if it exists, then the author_id should reveal the ids for the relevant books and then these should be printed (or echoed) in the output. Gets kind of complicated doesn't it? Or would it all be simpler to just enter all the authors' names in the author field and then do a search for an author within the fields as a string? I suspect this would be rather slow. Also, same for categories and sellers since the whole database has to be searched? Am I on the right track? TIA -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org