Computer Science, asked by sagar10031, 1 year ago

what is primary key and foreign key​

Answers

Answered by Rakshit7
13

PRIMARY KEY

A field or a set of fields that uniquely identify each record in a table is known as a primary key. Each relation has at least one column for which each row that must have a unique value. Only one column attributes can be defined as a primary key for each table.

Eg: In the Student table, studentId works as a primary key because it contains IDs which are unique for each student.

FOREIGN KEY:

A field of a table that references the primary key of another table is referred to as foreign key. The relationship between two tables is established with the help of foreign key. A table may have multiple foreign keys and each foreign key can have a different referenced table .

Eg: course Id column of student table works as foreign key as well as primary key for Course table.

HOPE IT HELPED IF YES PLEASE MARK AS BRAINLIEST....


Rakshit7: Please mark as BRAINLIEST
Answered by Thrivarshitha377
3

Answer: primary key foreign key

Explanation:1. Primary key: a primary key is a unique value that identifies a row in a table. for example student table contains column such as admission number,name, date of birth, address, phone and admission number can be considered as a primary key.

2. Foreign key: a foreign key is a field or a column that is used to establish a link between two tables. in simple words you can say that a foreign key is one table used to point a primary key in another table.

Hope you like it.

Similar questions