NYCPHP Meetup

NYPHP.org

[nycphp-talk] [OffTopic] database design question

jim.bishop nyphp at jimbishop.org
Tue Aug 5 09:16:12 EDT 2003


I'm designing a new user database for a personal project, and I was toying
with a different method of storing the data than I have used before.
Usually I create tables with logical column names that reference the data
in the column.

For Example:

---------------
| User        |
---------------
| id          |
| first_name  |
| last_name   |
| email       |

...
---------------

But this becomes cumbersome when you have to add fields to the table.  I
have designed a new table structure that looks like this:


---------------
| User        |
---------------
| uid         |
---------------

-----------------
| UserAttribute |
-----------------
| attribute_id  |
| uid_fk        | * foreign key to user table
| attribute     |
| value         |
-----------------

Okay.  So I've built many user databases before and never employed the
system below.  Has anyone else?  Besides the requisit JOIN that has to be
called with every SELECT, what is the downsides to using this kind of
architecture?





More information about the talk mailing list