Primary & Foreign keys

Top  Previous  Next

Primary and Foreign Keys

 

 

All data tables have a primary key. This primary key is formed by using the lower case letter: 'i' then the 2nd - 6th character in the file name then the 3 lower case letters: 'iid'  All data tables have the extension 'dbf' Example: m6nmpt.dbf

 

Example:

       The patient demographic data table is m6nmpt        -  primary key is inmptiid

       The patient insurance data table is m6ptin        -  primary key is iptiniid

       The insurance/payer lookup file is m6nmco        -  primary key is inmcoiid

 

 

The primary key is used as a 'foreign' key when linking to another data table.

 

Example:

       

Find the name of the patient's primary payer.

        m6nmpt.inmptiid (primary key) is used in m6ptin.inmptiid (foreign key)

        m6nmco.inmcoiid (primary key) is used in m6ptin.inmcoiid (foreign key)

 

       So the linkage goes like this:

        m6nmpt.inmptiid > m6ptin.inmptiid > m6ptin.inmcoiid > m6nmco.inmcoiid