Showing posts with label unique index vs primary key. Show all posts
Showing posts with label unique index vs primary key. Show all posts

Wednesday, October 08, 2008

One of the junior DBAs asked me this question. I thought it was a good enough reason to blog.

I am not touching what primary key helps us achieve, but what's difference in executing just

create unique index x.y on table xx.yy allow reverse scans;

than

create unique index x.y on table xx.yy allow reverse scans;
alter table xx.yy add constraint -- and give the columns in the above defined unique index


unique index can have one row with null value in either of columns, while primary key disallows it :)