Re: Easy Modeling Qs

From: JRStern <JXSternChangeX2R_at_gte.net>
Date: Mon, 01 Jul 2002 23:03:20 GMT
Message-ID: <3d20dfbe.32795427_at_news.verizon.net>


On 1 Jul 2002 13:47:43 -0700, jdriller_at_orchid.org (Jonathan Driller) wrote:
>I have just ordered a book on modeling but am struggling with some
>basic Qs that yield conflicting answers on the Web:
>1)In 2 tables with a 1:1 relationship, I think I could combine them
>into 1 table but think it would be more efficient to have 2. Can I use
>the primary key of the 1 table as the foriegn AND primary key of the
>second?

Yes. That's a horizontal partitioning of a single table.

>If yes, do I simply say something like "create table
>second_table(x_id not null primary key references main_table, anum
>int(2));"? Normally I would use an identity column for each table but
>now I am thinking that is a waste of space when I can uniquely
>identify a column with another tables primary key.

I'd have to bestir myself to check the syntax, but basically, yeah.

It just pains me when someone says, "Normally I would use an identity column." Sigh. I should just get used to it.

>2) This one is maybe a consequence of staring at things too long: I
>have a table that is a 1:n to 3 different tables...can I do that?

Yes. There's a name for that, too, but it escapes me.

Nothing wrong with it at all.

J. Received on Tue Jul 02 2002 - 01:03:20 CEST

Original text of this message