954,566 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Foreign and primary key

hai friend's

i am beginner in MS sql db .

so can any one explain me detail about Foreign key and primary key ,

please give example also ,

thank;s in advance.....

dskumar_85
Junior Poster in Training
69 posts since Mar 2008
Reputation Points: 9
Solved Threads: 1
 

Primary key is the unique identifier of a row of data. like:
table Dogs:
dogid=1(pk)unique
dogname=spot
dogbreadid=5(fk)
age=3

dogid is the dog spots unique identifier in the db. dogbreadid is the foreign key. this links the dog to the bread table.
table bread
breadid=5(PK)unique identifier
breadname=Chihuahua

this lets you know that spot is a Chihuahua.
does this help you any?

ProfessorPC
Posting Whiz in Training
270 posts since Dec 2007
Reputation Points: 31
Solved Threads: 29
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You