Re: database for books question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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.


???

Sorry I didn't seem to get this email? Was it posted to the list?


In that case you WILL need an intermediatery table then as John proposed. My method works similiar but its a one-to-one relationship per subject


Apart from that the rest should follow suite the same..

tata



---oOo--- Allowing users to execute CGI scripts in any directory should only be considered if: ... a.. You have no users, and nobody ever visits your server. ... Extracted Quote: Security Tips - Apache HTTP Server ---oOo--- ------oOo---------------oOo------ Julien Bonastre [The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494 julien@xxxxxxxxxxxxxxxx www.the-spectrum.org ------oOo---------------oOo------ ----- Original Message ----- From: "John Meyer" <john.l.meyer@xxxxxxxxx>
To: "Flint Million" <fmillion@xxxxxxxxx>; <php-db@xxxxxxxxxxxxx>
Sent: Sunday, January 22, 2006 10:14 AM
Subject: Re:  database for books question


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



--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 20/01/2006





--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 20/01/2006

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux