Primary and Foreign Key Relationship

What is primary key field and what is foriegn key field and their relationship?

Primary key field is the the database table column which helps in identifying the records uniquely in master table.

Foreign key field is the database table column of a details table which is dependent on the primary key field of a parent table .
e.g - In Employee Master Data table (Dept_ID is the foreign key)

       Emp_ID     Emp_name  Dept_ID

             1           aaa              10
             2           bbb             20
             3           ccc              30
             4           ddd             40
             5           eee              20
             6           fff                10
             7           ggg              30
             8           hhh              50
             9           iii                 10
            10          jjj                30

In Employee Details Data table (Dept_ID is the Primary key)

         Dept_ID         Dept_Name

            10               Accounts
            20               Sales
            30               Purchase
            40               Inventory
            50               Administration

The above information is sufficient for you to undersatnd the concept of primary and foreign key relationship.

Related:

ABAP Books List
ABAP/4 Certification, Programming, Smartforms, Sapscripts and Object Oriented Programming Books

Smart Forms
SAP Smartforms

Back to ABAP Menu:
ABAP Example Hints and Tips

Return to :-
SAP Hints and Tips on Configuration and ABAP/4 Programming

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.  The site www.gotothings.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.