Re: Inserting into two table

From: Matt Mitchell (m_a_t_t_remove_the_underscores_at_metalsponge.net)
Date: 02/18/05


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



Relevant Pages

  • Re: Langham: a victim of gross injustice
    ... I can see that he could perceive being made to admit that he did wrong ... doubt as to whether he really is turned on by the images but should have ... known better than to risk downloading the stuff, ... Langham with a journalist or a police officer and your doubts ...
    (uk.legal)
  • Re: Determining if it is "safe" to send UDP packets
    ... >>reasons for using UDP. ... We want to transfer images obtained from a camera as fast ... > packet does not get received. ... I don't know if it will help in your UDP case, ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Interpolation of positive functions
    ... dudesinmexico@xxxxxxxxx a scris: ... even when they are applied to sampled functions that, ... reasons, are known to be always positive (e.g. digitized images). ...
    (sci.math.num-analysis)
  • Re: Killfiling The Resident P&S Troll, Along With Replies.
    ... but he invariably went ballistic with silly defenses of his ... images, rather than admit he had much to learn. ... He's just one of those types that finds it difficult to admit that he does not know everything about everything. ...
    (rec.photo.digital)