Re: DB design question (so maybe a little OT)
| From: | Doug Semig | Date: | Fri, 07 Sep 2001 19:16:22 +0000 |
| Subject: | Re: DB design question (so maybe a little OT) | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-12258@lists.php.net to get a copy of this message | ||
Hi Alexander--
I see folks have already answered your question. However, I would like to
mention why what you're doing is not-so-great.
How would you search your current db for a person? You have to Union all
the tables together to do what would otherwise be a simple search, or fire
off four SELECT statements. Both are not optimal because if you add a
fifth kind of person you have to change code and SQL statements all over
the place.
With everything in one table (and perhaps additional tables for person-type
specific data), searching your DB on fields common to all people (name,
number of years employed by the company, etc., for example) is easier on
the database (no UNION or pounding the DB with SELECTs), and code only has
to be added to handle new types of people if it is required. The vast
majority of your existing code and the SQL statements will remain the same
in the future.
Hope this helps,
Doug
At 08:26 PM 9/7/01 +0000, Alexander Deruwe wrote:
>Hey all,
>
>I have 4 database tables, that each describe some sort of 'person'
>(transporting company, truck-driver, ..) and have almost exactly the same
>fields.
>Is this the best way of storing this, or does this make more sense:
>
[--snip--]
--Doug's Signature File----------------------------------------
~ ~ ~ I'm proud to work for GLISnet, Michigan's best ISP ~ ~ ~
--1.888.445.4763---8am to 8pm every day-- http://www.glis.net -
The views and opinions expressed in this email are my
own and may not be those of my employer.
# # # # Ghosthunter? http://groups.yahoo.com/group/mmsm # # # #