Computer Science, asked by noorkaurh, 7 months ago

State the difference between primary key and foreign key?​

Answers

Answered by harmanpreetkaur76
4

Answer:

A primary key is used to ensure data in the specific column is unique. A foreign key is a column or group of columns in a relational database table that provides a link between data in two tables. It uniquely identifies a record in the relational database table.

Explanation:

please mark it as brainliest

Answered by sanjanakumari54
1

Primary key:-

  • Primary key is used to identify data uniquely therefore two rows can’t have the same primary key. It is used to uniquely identify data in the table.
  • It can’t be null.
  • Two or more rows can’t have same primary key.
  • Primary has clustered index.
  • Primary key constraint can be defined on temporary table.
  • Its value cannot be deleted from the parent table.

Foreign key:-

  • Foreign key is used to maintain relationship between two tables.
  • It can accept the null values.
  • It can carry duplicate value for a foreign key attribute.
  • By default, It is not clustered index.
  • It can’t be defined on temporary tables.
  • Its value can be deleted from the child table.

Hope above of my answer's will be helpful to you...........

If you are satisfied than please mark me as brainliest...............

Similar questions