Question

Explain the following violation with an illustration. i)Domain constraint ii)Key constraint iii)Referential integrity iv)entity integrity

Explain the following violation with an illustration.

i)Domain constraint

ii)Key constraint

iii)Referential integrity

iv)entity integrity

0 0
Add a comment Improve this question Transcribed image text
Answer #1

¡) Domain constraint :-

-- Domain constraint simply defines the domain or set of values for an attribute.

--It says the value of the attribute must be available in the corresponding domain.

-- If the attribute datatype is an integer then attribute values must be in integer.

Let's take an example:

Student_id Name Age
101 Rahul 19
102 Ajay C
B Santosh 19

Here , value ‘B’ is not allowed since only integer values can be taken by the "Student_id" attribute.

And ,value 'C' is not allowed since only integer values can be taken by the "Age" attribute.

¡¡) Key Constraint:-

-- keys are simply an entity set which are used to identify an entity within its set uniquely.

-- Key Constraint says that all the values of primary key must be UNIQUE.

--And , the values of the primary key must not be a NULL value.

Let's take an example :

Student_id Name Age
101 Rahul 19
102 Ajay 18
101 Santosh 19

Here, Student_id is the primary key and this relation does not satisfy the key constraint as here all the values of primary key are not unique.

¡¡¡) Referential Integrity :-

-- Referential Integrity Constraint is specified between two tables.

-- 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.

Let's take an example :

Table -1:

Student_id Name Age Phone_no
101 Rahul 19 1234
102 Ajay 18 5236
103 Santosh 19 9876

Here , Phone_no is a foreign key.

Table-1 relationships with Table-2 .

Table -2:

Phone_no Address
1234 kurnool
5236 ongole

-- Here , Phone_no is the primary key.

-- Here , in Table-1 9876 is not allowed as Phone_no 9876 is not defined as a Primary key of Table-2 and in Table-1 Phone_no is a foreign key defined.

¡v) Entity Integrity :-

-- Entity integrity constraint specifies that no attribute of primary key must contain a null value in any relation.

--This is because the presence of null value in the primary key violates the uniqueness property.

Let's take an example :

Student_id Name Age
101 Rahul 19
102 Ajay 18
Santosh 19

-- This relation does not satisfy the entity integrity constraint as here the primary key contains a NULL value.

Add a comment
Know the answer?
Add Answer to:
Explain the following violation with an illustration. i)Domain constraint ii)Key constraint iii)Referential integrity iv)entity integrity
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT