KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is it possible to set a unique constraint as a foreign key in another table? If yes, how would you go about declaring it? How would you go about assigning a candidate key? Is it possible? Example: I have a product table that consists of: prod_id, prod_name, prod_price, QOH Where I want prod_name to link to the despatch table: desp_id, prod_name, shelfLoc, quantity What I was thinking is that I may need to create a unique constraint which will look like this: ALTER TABLE product ADD CONSTRAINT prod_nameID_uc UNIQUE (prod_id,prod_name) What I'm wondering is, if it is possible to refer to a unique key as a foreign key in the despatch table. I have to have prod_name rather than prod_id in the despatch table so that the information is more meaningful to the user when reading it, rather than seeing an id number. I am using iSQL plus on oracle.
Tags (comma-separated)
Save Edits
Cancel