Is it possible to set a unique constraint as a foreign key in another table? If so, how would you announce it?
How are you going to assign the 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 reference the dispatch table:
desp_id, prod_name, shelfLoc, quantity
I thought that I might need to create a unique constraint that would look like this:
ALTER TABLE product ADD CONSTRAINT prod_nameID_uc UNIQUE (prod_id,prod_name)
I am wondering if you can specify a unique key as a foreign key in the send table. I should have prod_name and not prod_id in the send table so that the information is more meaningful to the user when reading, instead of seeing the identifier number. I am using iSQL plus in oracle.
oracle unique constraints foreign-keys
taksIV
source share