Reply to Re: Database design

Your name:

Reply:


Posted by M@ on 05/25/07 17:15

If I am understanding correctly, you want to be able to take the PK
from the master table, and use it as the PK in the detail table as
well? It sounds like from your description that you have two purchase
order tables, correct? So again, if my assumption is correct, you
want to be able to use the PK from either master as the PK in the
detail table right?

If so, I think you'll have a problem with the detail table in that you
can have the same number come up for both master tables, thereby
inserting a row into the detail table that is a duplicate.

Can you concat something onto the insert into the detail? ie:
MasterTbl1 and MasterTbl2 send entries to Detail. MasterTbl1 sends a
3, and since it's from that table, it tacks a M1 onto the beginning or
M2 if it's the other table - M13 or M23

That would set up your detail table like this:
PK
M11
M12
M21
M22
M13
M23

but that doesn't solve your keeping them in order, so maybe you could
tack it on the end?
1M1
1M2
2M1
3M1
2M2
3M2

hth
M@



On May 25, 12:18 pm, KR <kra...@bastyr.edu> wrote:
> Hi All,
>
> I wanted the expert opinion out there in the use of foreign keys as
> primary keys in a table. I am not very good at explaining this
> concept, but I am going to try -
>
> Let us say you have a parent/master table( Ex: purchase order) that
> is generating number (primary key for the main table)using the seed
> and increment specified. We need all the records of this table to be
> in sequential order - i.e. we need all purchase orders to be in
> sequence. Now there are two different types purchase orders different
> enough to have entity/tables of their own. So what are the downsides
> of using the primary key generated in the main table which would
> normally be a foreign key to the child table, as the actual primary
> key in the child tables.
>
> Thanks
>
> KR

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация