-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Flint Million wrote:
> Good idea. OK so I'll create a new database with subject ID's. Now, back in
> the primary database, how can I have multiple subjects assigned to one book?
> Let's say I repeat my above example and we assign "Nonfiction" to 1,
> "Technology" to 4, and "Linux" to 5. I know I might be getting off PHP topic
> here, but what's the best way then to have the database be able to reference
> multiple subjects per record? Or, would I have to do like "subject0 subject1
> subject2 etc." fields considering the maximum number of subjects per book? I
> still want to be ao search by subject and any book that has that particualr
> subject assigned to it would be returned.
> 


Here's how
Table:

BOOKS
  BOOK_ID
  BOOK_NAME
....
PK: BOOK_ID

SUBJECTS
  SUBJECT_ID
  SUBJECT_NAME
PK: SUBJECT_ID

BOOK_SUBJECT
   BOOK_ID (references BOOKS)
   SUBJECT_ID (references SUBJECTS)
PK: (BOOK_ID,SUBJECT_ID)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFD0s5Hj60GAoLuoDkRAlu2AJ4wqmitcKOpSwxiosJIrxHRr4swEACfUy4N
biTma4v6Kw5ZWps879Xa9Jg=
=D0Nk
-----END PGP SIGNATURE-----

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to