‎2007 Mar 01 6:40 AM
hi experts,
what is primarykry and forignkey.
thanks in advance
radhakrishna.
‎2007 Mar 01 6:43 AM
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
‎2007 Mar 01 6:44 AM
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
‎2007 Mar 01 6:45 AM
‎2007 Mar 01 6:46 AM
HI,
GO THROUGH THE BELOW LINKS...
http://dev.mysql.com/doc/maxdb/en/c3/4533403b292b22e10000000a1550b0/content.htm
Regards,
Nagaraj
‎2007 Mar 01 6:49 AM
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
‎2007 Mar 01 6:53 AM
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