DB design - which table to have a reference from?
| From: | Leif K-Brooks | Date: | Tue, 21 Jan 2003 17:37:26 +0000 |
| Subject: | DB design - which table to have a reference from? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-25014@lists.php.net to get a copy of this message | ||
I'm working on a site, and one feature will require two tables to store data. Records in table1 will sometimes (but not always!) also have an associated record in table2. When considering the design for this, I'm puzzled by one question: which table should reference which? Should the design be:
----table1-----
| id | table2_id |
--table2--
| id |or: --table1--
| id |----table2----- | id | table1_id | -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.