Hello everybody,
please tell me what is the potential difference between a column declared as
"primary key"
and
"not null unique"
thank you all
akber
Printable View
Hello everybody,
please tell me what is the potential difference between a column declared as
"primary key"
and
"not null unique"
thank you all
akber
When you define a primary key, oracle creates a key index. And you will have just one constraint instead of two. Furthermore, foreign key references are not allowed on a column unless defined as a primary key.
Dear Kris,
Thank you for you reply.
Please note that i could create a reference to one table from another table without declaring one column as primary key. I declared a column as "unique" and could make a reference to this table from another table successfully as shown below
create table a(aa number unique);
create table b(bb number references a(aa));
So by declaring as "unique not null" also will do the same job. Since 'aa' is declared as unique, a unique index is created by default. So the difference comes only in two constraints vs single constraint.
What difference it makes to database performance when a column declared as single against two constraints
Please reply
Thank You
Akber