Results 1 to 5 of 5

Thread: Foriegn Key

  1. #1
    Join Date
    Feb 2009
    Posts
    36

    Unanswered: Foriegn Key

    Hiiii To All...
    How To Avoid The Redundancy/duplication Of Foreign Key Values In A Table ????

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Normalization, perhaps?

  3. #3
    Join Date
    Jan 2009
    Posts
    17
    specify unique constraint for that column

    create table tt1 (eid number primary key,ename varchar2(20),dno number unique,
    constraint fk_dno foreign key(dno) references dept(deptno))

  4. #4
    Join Date
    Feb 2009
    Posts
    36
    Quote Originally Posted by sridhar.dbe
    specify unique constraint for that column

    create table tt1 (eid number primary key,ename varchar2(20),dno number unique,
    constraint fk_dno foreign key(dno) references dept(deptno))

    thanks for reply,plz help again
    if i want 2 or more combination of columns in single table to be unique then what to do??

  5. #5
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Quote Originally Posted by ANGEL_G
    if i want 2 or more combination of columns in single table to be unique then what to do??
    Code:
    constraint xxx_uk unique (col1, col2, col3)
    However, note that if any of these columns can be null, then rows where one or more of them is null will not violate the constraint - only all-non-null entries are validated.

Posting Permissions

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