solulubeta
Sign in
CS Theory / Database Management Systems
02.03 · Lesson

Relational Constraints & Keys

Relational constraints are the restrictions imposed on the database contents and operations. They ensure the correctness of data in the database.

3 min Free

Relational Constraints

Relational constraints are the restrictions imposed on the database contents and operations. They ensure the correctness of data in the database.

  • Domain Constraint - Domain constraint defines the domain or set of values for an attribute. It specifies that the value taken by the attribute must be the atomic value from its domain.
  • Tuple Uniqueness Constraint - Tuple Uniqueness constraint specifies that all the tuples must be necessarily unique in any relation.
  • Key Constraint - All the values of the primary key must be unique. The value of the primary key must not be null.
  • Entity Integrity Constraint - Entity integrity constraint specifies that no attribute of primary key must contain a null value in any relation.
  • Referential Integrity Constraint - It specifies that all the values taken by the foreign key must either be available in the relation of the primary key or be null.

Closure of an Attribute Set

The set of all those attributes which can be functionally determined from an attribute set is called a closure of that attribute set.

Types of Keys

A key is a set of attributes that can identify each tuple uniquely in the given relation.

  • Super Key - A superkey is a set of attributes that can identify each tuple uniquely in the given relation. A super key may consist of any number of attributes.
  • Candidate Key - A set of minimal attribute(s) that can identify each tuple uniquely in the given relation is called a candidate key.
  • Primary Key - A primary key is a candidate key that the database designer selects while designing the database. Primary Keys are unique and NOT NULL.
  • Alternate Key - Candidate keys that are left unimplemented or unused after implementing the primary key are called as alternate keys.
  • Foreign Key - An attribute ‘X’ is called as a foreign key to some other attribute ‘Y’ when its values are dependent on the values of attribute ‘Y’. The relation in which attribute ‘Y’ is present is called as the referenced relation. The relation in which attribute ‘X’ is present is called as the referencing relation.
  • Composite Key - A primary key composed of multiple attributes and not just a single attribute is called a composite key.
  • Unique Key - It is unique for all the records of the table. Once assigned, its value cannot be changed i.e. it is non-updatable. It may have a NULL value.
Mark this as done when you are finished.

Item 10 of 28 · updated 2026-10-12