Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

primary key

Former Member
0 Kudos

hi experts,

what is primarykry and forignkey.

thanks in advance

radhakrishna.

6 REPLIES 6

Former Member
0 Kudos

Hi,

Primary key is the UNIQUE key in each and every table.

There won't be duplicates and NULL values for this.

Foreign key means it is a key in one table and a Primary key in other table.

In the first table you have to define the relationship with that second table.

Regards,

Anji

sreeramkumar_madisetty
Active Contributor
0 Kudos

Hi

Primary key : The field which is Unique and not null is called the Primary Key field

Foreign Key : To establish the relations between 2 tables the same key kield in another table is the Foreign key.

Foreign key can or can not be Unique and not-null.

Regards,

kumar

Former Member

former_member404244
Active Contributor
0 Kudos

Former Member
0 Kudos

hi,

Primary key : The field which is Unique and not null is called the Primary Key field

You can define the relationships between tables in the ABAP Dictionary by creating foreign keys.

Using foreign keys, you can easily create value checks for input fields

foreign key links two tables T1 and T2 by assigning fields of table T1 to the primary key fields of table T2.

for detailed info:

http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ea77446011d189700000e8322d00/content.htm

regards,

keerthi

Former Member
0 Kudos

hi

Primary key is the identity of a table in which it is defined..i mean every table has atleast one primary key with primary index (0). A table without this key is not said to be a complete table becoz other tables cannot be related with this table if it does not hav a primary key. The relationship isdefined wtih Foriegn key.

eg: tab1 has f1 as its primary key and f2 f3 has its secondary keys. and tab2 has f2 as its primary key and f4 f5 as its secondary keys. To relate these tables..Foriegn key is defined. Also without a foriegn key, two tables can be related if both of them has the key in common. In this case, f2 is the common key between them. If there is no common keys, then foriegn key(S) are created and the relationship is done.

if you're fetching data from tab1..then it becoms the check table as it has f2 as the secondary key and tab2 becomes the check table as it has f2 as primary key.

regards,

shamim