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? Sorry, I'm a real noob at oracle.
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.