Re: Inserting into two table
From: Matt Mitchell (m_a_t_t_remove_the_underscores_at_metalsponge.net)
Date: 02/18/05
- Next message: Daniel Andersen: "open_basedir and mod_vhost_alias"
- Previous message: elena_at_monmouth.com: "Help with research"
- In reply to: simon: "Re: Inserting into two table"
- Next in thread: simon: "Re: Inserting into two table"
- Reply: simon: "Re: Inserting into two table"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 17 Feb 2005 23:55:16 GMT
"simon" <spambucket@myoddweb.com> wrote in message
news:37k968F5ck66qU1@individual.net...
>> 3 - There's a certain school of thought that says you might need to
>> rethink your data/application design to avoid this situation being
>> necessary if possible...
>
> Why would you say that? I can see good reasons to have a split table.
> For example on section contains an (int)ID while another contains some
> text related to that ID and again another table that contains images
> related to that ID and so on.
>
> But if you have a link I would be interested to have a look at it.
>
> Simon
Sounds like you're over-normalising your data, at least maybe a little.
Couldn't the text relating to the id be stored in the same table, if it's
part of some kind of "profile" information?
Ditto with the pictures (although I have to admit I normally store info on
images in a special table, so I can see a case for this)
Certainly, any information that relates to the id, and doesn't depend on any
other data, probably ought to be in the same table. This will also help
your performance, or should do, as it will reduce the number of joins that
you need.
That said, if it's a question of adding a user, and then returning the new
user id, or setting some fields afterwards, you could use insertid.
If you're adding data to another table that's solely dependent on the first
table's primary key, it might be worth thinking about whether that data
actually belongs in the first table too...
Matt
- Next message: Daniel Andersen: "open_basedir and mod_vhost_alias"
- Previous message: elena_at_monmouth.com: "Help with research"
- In reply to: simon: "Re: Inserting into two table"
- Next in thread: simon: "Re: Inserting into two table"
- Reply: simon: "Re: Inserting into two table"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|