Discussion in 'Database' started by go4expert, Jun 1, 2005.
why we should introduce the referential integrity before the data entered?
The one and the only reason that we should introduce the referential integrity before the data entered so that the whatever data has been entered also follows the same referential integrity.
If we take an example it will be much clearer
Now there is no referential integrity initially and there is no data as well.
Say now I would like to insert a new employee. Then as there is no data in the department table the employee can only be in on department but if we dont have the referential integrity a situation may come where there is no valid department for the employee.
Now there are some Departments and some employees. Then when I mistype a department then again the employee goes into a no department situation.
If we dont have the tables as empty and would like to put the referential integrity on the existing data there can be situation where they will not follow the referential integrity and so Habraken, suggest that one should probably set up relationships and enforce referential integrity before one tries to enter any data in the related tables.
Separate names with a comma.