What is the primary purpose of domain constraints in a relational database?

2025

What is the primary purpose of domain constraints in a relational database?

  1. A.

    It assigns rules about which values are allowed to be entered in a column.

  2. B.

    It makes sure that no NULL values are allowed in any row.

  3. C.

    It ensures that every row has a unique primary key.

  4. D.

    It links two tables using common columns.

  5. E.

    It automatically fills a default value when none is provided.

Attempted by 2 students.

Show answer & explanation

Correct answer: A

Concept

A domain constraint is the most basic integrity rule in the relational model. For each attribute (column) it fixes a domain — the set of permissible atomic values, defined by the data type plus any allowed range, format, or enumerated set. Every value stored in that column must be drawn from this domain, so a domain constraint governs which values are legal in a single column.

Application to this question

The purpose asked for is the one that describes restricting the legal values of a column. "Assigns rules about which values are allowed to be entered in a column" is exactly the definition of a domain constraint — e.g. declaring Age INT CHECK (Age > 0) or Gender CHAR(1) CHECK (Gender IN ('M','F')). The DBMS rejects any insert or update whose value falls outside the column's domain.

Why the other purposes are different constraints

  • Forbidding NULLs in every row is a NOT NULL constraint — it controls presence/absence of a value, not the set of allowed values.

  • Guaranteeing a unique primary key is a key (entity-integrity) constraint — it enforces uniqueness across rows, not the permitted values of a column.

  • Linking two tables through common columns is a referential-integrity (foreign-key) constraint — it ties a value to an existing key in another table.

  • Filling a value automatically when none is supplied is a DEFAULT constraint — it supplies a value, it does not restrict the set of allowed values.

Only the first purpose restricts the legal values of a column, which is precisely what a domain constraint does.

Explore the full course: Niacl Ao It Specialist