N/APosted on - 03/22/2012
I have two tables in my sql database one is "vendor" and other "purchase_order" they both have one common attribute "vendor_name" my problem is that i want vendor name in my "purchase_order" table to be same as that in "vendor" table but vendor_name is not a primary key in "vendor" table so i cannot use primary key_foreign_key reference.
Could anyone help me what should I use?
How to check constraints on two tables without primary key -foreign
Seems a pretty difficult situation. But in order to tackle this down use the following techniques that i will going to tell you.
First of all do the old school method by simply copy pasting the attribute in the 2nd table so that you can use it to your likings and that there is no dependencies that are harmed.
After that you can try using any other key like the candidate key or the secondary key. They also serve the purpose after the primary key is set inside the table.
Make sure that you do whatever to make sure that there is no other problems inside the system. Also backup the data so that if any thing goes wrong you have the backup.