हिंदी

Explain the use of ‘Foreign Key’ in a Relational Database Management System. Give example to support your answer.

Advertisements
Advertisements

प्रश्न

Explain the use of ‘Foreign Key’ in a Relational Database Management System. Give example to support your answer.

संक्षेप में उत्तर
Advertisements

उत्तर

A foreign key is used to set or represent a relationship between two relations ( or tables) in a database. Its value is derived from the primary key attribute of another relation.

For example: In the tables TRAINER and COURSE given below, TID is the primary key in the TRAINER table but the foreign key in the COURSE table.

TRAINER

TID TNAME CITY HIRE DATE SALARY
101 Mohan Delhi 1987-09-05 57000
102 Sohan Goa 1997-11-15 70000
103 Jyoti Mumbai 2000-08-21 75000
104 Jayesh Nagpur 2005-06-10 65000
105 Leena Agra 1990-11-05 85000
106 Juhi Chandigarh 2004-09-25 50000

COURSE

CID CNAME FEES START DATE TID
C201 Sujay 12000 2018-07-02 101
C202 Kartik 15000 2018-07-15 103
C203 Deepa 10000 2018-10-01 102
C204 Anagha 9000 2018-09-15 104
C205 Yash 20000 2018-08-01 101
shaalaa.com
Keys in a Relational Database
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2022-2023 (March) Sample
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×