sql queries
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: sql queries

  1. #1
    Join Date
    Feb 2002
    Hello everybody,
    please tell me what is the potential difference between a column declared as
    "primary key"
    "not null unique"

    thank you all
    Vidhipariprashnena Sevaya
    (sanskrit an Indian Language means
    "Educate yourself to serve others")

  2. #2
    Join Date
    May 2001
    San Francisco, California
    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.
    Remember the Golden Rule - He who has the gold makes the rules!
    Ph.D., OCP 8i, 9i, 10g, 11g DBA

  3. #3
    Join Date
    Feb 2002


    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
    Vidhipariprashnena Sevaya
    (sanskrit an Indian Language means
    "Educate yourself to serve others")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width