Social Sciences, asked by lilmag6653, 1 year ago

Consider two tables a and
b. id is the primary column in table
a. a_id is the foreign key in table b which is linked with id column of table
a. can a_id in table b can store a value which is not present in id column of table a?

Answers

Answered by sawakkincsem
1

Thank you for asking this query. Let me provide you solution with example.

a_id is primary key which links as foreign key in column table b for example if a_id is 45 in column a its also store on b column as foreign key. If we delete parent id e.g. primary id of a_id from a table then a_id which is 45 also available or store in table b thus this situation is called orphan record. Value stored as orphan record and deletion anomalies occurs which means if we delete id from parent or primary key of a table and forget to delete this id on b table thus it will available in b table which means information about that old entry of a table of a_id may need to be deleted from more than one place.

I hope this solution will help you.

Answered by writersparadise
2
The answer is NO.

In this case it is not possible because the foreign key of Table B has been set to be linked with the primary key of Table A.

However, the foreign key in the second table need not always be linked to the primary key of another table. It can be linked to any unique entry of the first table.
Similar questions