An attribute (or attributes) that uniquely identifies each row in a relation is called a:

Definition of a key

An attribute (or attributes) that uniquely identifies each row in a relation is called a:

A key is an attribute or a combination of attributes that uniquely identifies each row within a table.  A key implies uniqueness, so in other words, a key functionally determines the entire row.  A determinant is not necessarily a key as determinants do not imply uniqueness.

For example:

In the content area [Functional Dependencies] we established the following functional dependencies of the SUPPLIER table from the Homewares database.

S_CODE S_NAME, S_CONTACT, S_SUBURB, S_AREACODE
S_SUBURB S_AREACODE

S_CODE is a key as well as being a determinant.  Every S_CODE value is unique, therefore each S_CODE yields a unique row within the table.

On the other hand, S_SUBURB is a determinant but it is not a key, because each S_SUBURB value is not unique.

Composite key

An attribute (or attributes) that uniquely identifies each row in a relation is called a:

Sometimes a key is a  combination of attributes.  A key that consists of two or more attributes is known as a Composite Key

For example, look at the COURSE_SUBJECT table from the University database.  Each row tells us whether a subject is core or elective of a particular course.  Given that a subject can be core in one course, but an elective in another, the Subject_Code alone would not identify each row uniquely.  Similarly, neither would Course#.  However, a combination of the two attributes would.

Sample Data:

Course# Subject_Code Subject_Type
ICA40299 ICAITB060A Core
ICA40299 ICAITU018B Elective
ICA40199 ICAITU018B Core

Each component of a composite key is known as a Key Attribute. When an attribute is functionally dependent on an entire composite key, and not just on parts of the composite key, then it is said to be fully functionally dependent.    Therefore, Subject_Type is fully functionally dependent on the composite key of Course#, Subject_Code.

Superkey

An attribute (or attributes) that uniquely identifies each row in a relation is called a:

In broad terms, a Superkey is an attribute, or combination of attributes, that functionally determines all of the table's other attributes.  Any of the following could be Superkeys of the SUPPLIER table from the Homewares database.

S_CODE
S_CODE, S_NAME
S_CODE, S_NAME, S_CONTACT
S_CODE, S_NAME, S_CONTACT, S_SUBURB
S_CODE, S_NAME, S_CONTACT, S_SUBURB

 Candidate key

An attribute (or attributes) that uniquely identifies each row in a relation is called a:

Sometimesmore than one attribute or more than one combination of attributes can uniquely identify each row within a table.

If a table contains more than one superkey that is a single attribute only, then each is called aCandidate Key. 

For Example:

If the PRODUCT table from the Homewares database contained an additional attribute called P_SERIAL# (assuming each product had a unique serial number), then either P_CODE or P_SERIAL# would uniquely identify each row and each would qualify as a candidate key. 

However, if the superkey is a combination of attributes, and one of those attributes is in itself a superkey, then the key cannot be a candidate key.  From the superkeys identified above, you can see that S_CODE by itself is a superkey, so the remaining superkeys do not qualify as candidate keys.

Primary Key

An attribute (or attributes) that uniquely identifies each row in a relation is called a:

Candidate keys can then serve as Primary Keys as long as the candidate key does not contain null values.

Using the Homewares database as an example, S_CODE from the SUPPLIER table and P_CODE from the PRODUCT table have been identified as the candidate keys.  As there is only one candidate key for each table, they will serve as the primary keys of each table.

The primary key must not be allowed to contain null values.  If any more than one supplier did not have an S_CODE value, this would effectively create suppliers with the same supplier code (null).

Alternate key

An attribute (or attributes) that uniquely identifies each row in a relation is called a:

Some tables contain more than one candidate key, but as there can only be one primary key, any remaining candidate keys are defined as Alternate Keys.

Foreign Key

An attribute (or attributes) that uniquely identifies each row in a relation is called a:

A tables primary key is used to establish relationships with other tables.  This is achieved by including the primary key of one table as the Foreign Key of another.  The general rule of thumb is to take the primary key of the one side of the relationship and include it in the table of the many side of the relationship.

Lets look at that SUPPLIER and PRODUCT tables from the Homewares database.  S_CODE, the primary key of the SUPPLIER table (the one side of the relationship) has been included in the PRODUCT table (the many side of the relationship) as the foreign key.  This establishes the one to many relationship between the two tables. 

P_Code P_Description P_Price S_Code
1455GE Saucepan, 3ltr $15.95 22211
2165GE Saucepan, 5ltr $26.50 22211
2355BB Chopping Board, wooden $6.95 36656
1978BW Chopping Board, wooden $8.50 11145
1289HT Bread Bin $15.95 24680
3241PL Bottle Opener $7.95 12345
1554SW Toaster, 4 slice $89.99 10056

Secondary key

An attribute (or attributes) that uniquely identifies each row in a relation is called a:

Among other things, primary keys are also used for effective data retrieval. A search on a primary key will yield only one record. When a primary key is not known, searches of the database are conducted using another attribute or a combination of attributes. These are defined as Secondary Keys.

An attribute (or attributes) that uniquely identifies each row in a relation is called a:

What is an attribute or attributes that uniquely identifies each row in a relation?

The Primary Key is one or more attributes that uniquely identifies any given row (or tuple) AND the attribute(s) making up that Primary Key cannot be NULL .

What uniquely identifies each row in a table?

Every table must have a primary key, which uniquely identifies rows in the table. Foreign keys are columns used to reference a primary key in another table.

Is an attribute or combination of attributes that uniquely identifies?

The primary key is an attribute or a set of attributes that uniquely identify a specific instance of an entity. Every entity in the data model must have a primary key whose values uniquely identify instances of the entity.

Which key is a set of one or more attributes that can uniquely identify a row in a given table?

Candidate key is a single key or a group of multiple keys that uniquely identify rows in a table.