0% found this document useful (0 votes)
8 views

All Keys

Uploaded by

Saeed Ahmed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

All Keys

Uploaded by

Saeed Ahmed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Unit-IV

Keys :-

➢ A DBMS key is an attribute or set of an attribute which helps you to identify a tuple
in a relation table.
➢ They allow us to find the relation between two tables.
➢ Keys help us uniquely identify a row in a table by a combination of one or more
columns in that table.

Super key :-

➢ A superkey is a group of single or multiple keys which identifies rows in a table.


➢ A Super key may have additional attributes that are not needed for unique
identification.

Alternate key :-

➢ ALTERNATE KEYS is a column or group of columns in a table that uniquely identify


every row in that table.
➢ A table can have multiple choices for a primary key but only one can be set as the
primary key.
➢ All the keys which are not primary key are called an Alternate Key.

Candidate key:_

➢ CANDIDATE KEY is a set of attributes that uniquely identify tuples in a table.


➢ Candidate Key is a super key with no repeated attributes.
➢ The Primary key should be selected from the candidate keys.
➢ Every table must have at least a single candidate key.
➢ A table can have multiple candidate keys but only a single primary key.

Properties of Candidate key:

➢ It must contain unique values


➢ Candidate key may have multiple attributes
➢ Must not contain null values
➢ It should contain minimum fields to ensure uniqueness
➢ Uniquely identify each record in a table

Compound key :-

➢ COMPOUND KEY has two or more attributes that allow you to uniquely recognize a
specific record.
➢ It is possible that each column may not be unique by itself within the database.
➢ However, when combined with the other column or columns the combination of
composite keys become unique.
➢ The purpose of compound key is to uniquely identify each record in the table.

Composite key :-

➢ COMPOSITE KEY is a combination of two or more columns that uniquely identify


rows in a table.
➢ The combination of columns guarantees uniqueness, though individually uniqueness
is not guaranteed.
➢ Hence, they are combined to uniquely identify records in a table.
➢ The difference between compound and the composite key is that any part of the
compound key can be a foreign key, but the composite key may or maybe not a part
of the foreign key.

Primary key :-

➢ PRIMARY KEY is a column or group of columns in a table that uniquely identify


every row in that table.
➢ The Primary Key can't be a duplicate meaning the same value can't appear more
than once in the table.
➢ A table cannot have more than one primary key.

Rules for defining Primary key:

➢ Two rows can't have the same primary key value


➢ It must for every row to have a primary key value.
➢ The primary key field cannot be null.
➢ The value in a primary key column can never be modified or updated if any
foreign key refers to that primary key.

Foreign key:-

➢ FOREIGN KEY is a column that creates a relationship between two tables.


➢ The purpose of Foreign keys is to maintain data integrity and allow navigation
between two different instances of an entity.
➢ It acts as a cross-reference between two tables as it references the primary key of
another table.
Functional dependency :-

➢ A functional dependency (FD) is a relationship between two attributes, typically


between the PK and other non-key attributes within a table.

➢ For any relation R, attribute Y is functionally dependent on attribute X (usually the


PK), if for every valid instance of X, that value of X uniquely determines the value
of Y.

➢ This relationship is indicated by the representation below :

X ———–> Y

➢ The left side of the above FD diagram is called the determinant, and the right side
is the dependent.

Fully functional dependency(FFD):-

The term full functional dependency (FFD) is used to indicate the minimum set of attributes
in of a functional dependency (FD).

In other words, the set of attributes X will be fufunctionally dependent on the set of
attributes Y if the following conditions are satisfied:

• X is functionally dependent on Y and


• X is not functionally dependent on any subset of Y.

Or

In a relation , there exists Full Functional Dependency between any two attributes X and Y,
when X is functionally dependent on Y and is not functionally dependent on any proper
subset of Y.

Partial Functional Dependency :

In a relation, there exists Partial Dependency, when a non prime attribute (the attributes
which are not a part of any candidate key ) is functionally dependent on a proper subset

You might also like