What is the difference between primary, unique and foreign key constraints, and indexes?

后端 未结 7 847
情深已故
情深已故 2021-01-30 11:25

What is the difference between primary, unique and foreign key constraints, and indexes?

I work on Oracle 10g<

7条回答
  •  既然无缘
    2021-01-30 11:51

    Here are some reference for you:

    Primary & foreign key Constraint.

    Primary Key: A primary key is a field or combination of fields that uniquely identify a record in a table, so that an individual record can be located without confusion.

    Foreign Key: A foreign key (sometimes called a referencing key) is a key used to link two tables together. Typically you take the primary key field from one table and insert it into the other table where it becomes a foreign key (it remains a primary key in the original table).

    Index, on the other hand, is an attribute that you can apply on some columns so that the data retrieval done on those columns can be speed up.

提交回复
热议问题