View Single Post

   
  #5 (permalink)  
Old 02-27-2008, 05:19 AM
Knut Stolze
 
Posts: n/a
Default Re: Difference between unique constraint and unique index?

aj wrote:

> DB2 WSE 8.1 FP5
> Red Hat AS 2.1
>
> What is the difference between adding a unique constraint like:


A unique index is a physical thing whereas a unique constraint is a data
modeling construct. As was already stated, unique constraint are
implemented by adding a unique index (and additionally requiring the NOT
NULL condition).

But you should also be aware that referential integrity (foreign key
constraints) can only reference unique constraints (or primary keys as a
special case for unique constraints). A foreign key _cannot_ reference a
unique index because it is just that: an index and not a constraint.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Reply With Quote