primary key


primary key

[′prī‚mer·ē ′kē] (computer science) A key that identifies a record or portion of a record and determines the sequence of records in a file or other data structure.

primary key

(database)A unique identifier, often an integer, thatlabels a certain row in a table of a relational database.

When this value occurs in other tables as a reference to aparticular row in the first table it is called a "foreignkey".

Some RDBMSes can generate a new unique identifier each timea new row is inserted, others merely allow a column to beconstrained to contain unique values.

A table may have multiple candidate keys, from which theprimary key is chosen. The primary key should be an arbitraryvalue, such as an autoincrementing integer. This avoidsdependence on uniqueness, permanence and format of existingcolumns with real-world meaning (e.g. a person's name) orother external identifier (e.g. social security number).

There should be enough possible primary key values to caterfor the current and expected number of rows, bearing in mindthat a wider column will generally be slower to process.

primary key

The column (field) in a relational database that uniquely identifies the row in the table. For example, account number is often a primary key. A "composite primary key" or "super key" is made up of two or more columns such as account number + name. See candidate key.