Oh sure and did you know you can have Primary and mulitple Foreign Keys with in the same table? The idea is you have only 1 primary key value in a parent table and it is used to 'relate' that record to the child table record. the child table may have it's own PK, because it too maybe a parent table to another table, and it would have a FK 'relating' it to the parent table

This is part of your Database Model and there are lots of book on Database Modeling.

In your example you could do something like
Customer with PK CustID
Project (which maybe the same as the TransHeader) with PK ProjectID and FK CustID
       ProjectRoom (TransDetail) w/ PK ProjRmID and FK Project ProjectID
           ProjectRoomElements w/ PK ProjRmElID and FK  ProjRmID

If this sounds way to confusing and this is a database that is pertinant to your business I would advise hiring a developer. An uptomized and true relational database for a business is not easy to do and since it is the back bone of any application, a good one makes things work great, a bad one...well not so great.

For a list of RBase developers go to http://www.rbase.com/developers/ . I think I can speak for all of us in saying, we would love to be of any assistance.

----- Original Message ----- From: <[EMAIL PROTECTED]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Wednesday, April 30, 2008 12:19 PM
Subject: [RBASE-L] - Re: Primary or Foreign Keys


Razzak or anyone else,

I am writing an interior design program.
Would it be over-kill to have multiple foreign keys:

customer-
primary to project
foreign to room/transaction header/transaction details

project-
primary to room
foreign to elements/transaction header/transaction details

a quick search could come up with each details.

Thank you,
Boyd

---- "A. Razzak Memon" <[EMAIL PROTECTED]> wrote:
At 05:24 PM 4/28/2008, [EMAIL PROTECTED] wrote:

>Razzak,
>
>I did read your article so for a primary key:
>not null or dup. value
>enforces constraints,
>use instead of rules
>builds an index.
>So all others will be foreign keys.
>
>Correct?

Very correct, Boyd!

To further understand the PK-FK relationship and a typical
relational database model, take a look at the latest RRBYW14.

CONNECT RRBYW14

At the R> Prompt:

   SET LINES 0
   LIST PKEYS
   LIST FKEYS
   LIST CONSTRAINTS

Very Best R:egards,

Razzak.





Reply via email to