Relational Model Concepts
Relational Model Concepts
1. Domain constraints
2. Key constraints
3. Referential integrity constraints
Domain Constraints:
1) These are attribute level constraints. An attribute can only take values
which lie inside the domain range. e.g,; If a constrains AGE>0 is applied
on STUDENT relation, inserting negative value of AGE will result in
failure.
Domain constraints specify that within each tuple, and the value of each
attribute must be unique. This is specified as data types which include
standard data types integers, real numbers, characters, Booleans, variable
length strings, etc.
Example:
Key constraints
An attribute that can uniquely identify a tuple in a relation is called the key of
the table. The value of the attribute for different tuples in the relation has to be
unique.
Example:
In the given table, CustomerID is a key attribute of Customer Table. It is most
likely to have a single key for one customer, CustomerID =1 is only for the
CustomerName =" Google".
1 Google Active
2 Amazon Active
3 Apple Inactive
Example:
Inset Operation
The insert operation gives values of the attribute for a new tuple which should
be inserted into a relation.
Update Operation
You can see that in the below-given relation table CustomerName= 'Apple' is
updated from Inactive to Active.
Delete Operation
To specify deletion, a condition on the attributes of the relation selects the
tuple to be deleted.
In the above-given example, CustomerName= "Apple" is deleted from the
table.
The Delete operation could violate referential integrity if the tuple which is
deleted is referenced by foreign keys from other tuples in the same database.
Select Operation