Home » RDBMS Server » Server Administration » Primary key Vs Unique+Not null
Primary key Vs Unique+Not null [message #370418] Wed, 22 September 1999 15:14 Go to next message
atul
Messages: 17
Registered: September 1999
Junior Member
Pls let me know the difference :
if two tables having same 2 fields
suppose emp_no number(3)
emp_name varchar2(30)

in one table I take emp_no as a primary key

and in other table I take emp_no as a Unique+not null

Thanks.
Re: Primary key Vs Unique+Not null [message #370423 is a reply to message #370418] Wed, 22 September 1999 17:24 Go to previous messageGo to next message
m a sivan
Messages: 34
Registered: July 1999
Member
well its same if u do exactly how u are explaining
as far as data etc is concerned but sometimes people use a composite primary key and some field as unique.

Also if u declare something as a primary key an automatic index is created which is not true when u declare it as unique and not NULL.
Re: Primary key Vs Unique+Not null [message #370453 is a reply to message #370418] Sun, 26 September 1999 13:05 Go to previous message
sonik chopra
Messages: 4
Registered: September 1999
Junior Member
hi atul,
if you do so in case of single field it will not affect.but it will drastically change the constraint in case of combined primary key.try to make a primary key(composite) on one table,do the same thing on another table by giving more than two collumns unique & not null & see the result by yourself.

keep in touch,
sonik
Previous Topic: loading Julian date into a variable
Next Topic: Re: triggers and sequences
Goto Forum:
  


Current Time: Fri Oct 30 03:33:24 CDT 2020