Application Development and Automation 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: 
Read only

KEYS

Former Member
0 Likes
642

HI TO ALL CAN U PLS GIVE DETAILED DESCRPTION ON

PLS DONT GIVE ANY SITE LINKS TRY TO GIVE ON UR OWN WORDS

what is the primary key .and tell the purpose of it?

what is the compound foreign key and purpose of it?

5 REPLIES 5
Read only

Former Member
0 Likes
610

Primary key: is the combination of fields in a database table which can help u to identify a unique record in the table, i.e., u can only have 1 record for the combination of primary key fields of a database table.

Read only

Former Member
0 Likes
610

Please do not use all Capital letters.

It is like shouting.

Primary Key is a unique identifier for a record.

For example, if you are in a class room, and somebody wants to call you, there is a chance that more than one person has the same name. hence name is not a primary key.

If they call by roll number, only one person will respond.

hence roll number is a primary key in this example.

Hope you understand.

regards,

ravi

Read only

Former Member
0 Likes
610

Hi Kumar,

Primary key defines a record in a table. So in a table you cannot have more than one record with the same key value.

Sometimes the value of a field in a table is determined by the values from another table. Or values that field can occupy is limited to values from another table. There

you define foreign key. I am not aware of compound foreign key.

Regards,

Aravind

Read only

Former Member
0 Likes
610

Hi,

A set of fields of a table which would uniquely identify rows of the table is called

Primary key.

The word compound as prefix to primary key or foreign key means the same.

If the key contains more than one field its called compound.

Foriegn key is something through which you can Refrential entity relationship.

that means how two tables are related.

For examples.

Employee can work in various departments

But department numbers should exist in department table.

so Deptno serves as foreign key between department and employee tables

Read only

Former Member
0 Likes
610

Foreign keys are used as check tables.

suppos ethere is a table to enter a students marks. ZSTUDMARK

fields are like.

student id

subject code

session

marks.

suppose when sombody key in data,

they shud not enter junk like 123 for student code. when someone key in syudent code, 3456, there shud be such a student code existing in the student master table say ZSTUDENT.

to make sur ethat, entries in ZSTUDMARK student id column are valid, this column of ZSUDMARK shud have a check table . and this check table must be, ZSTUDENT-STUDENTID. this relation is called foreign key

similarly when some onter a subject it shud be a valid subject , and that shud be verified against zstsubject table which have subject codes.