Foreign key refer to unique constraint????

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • KULJEET

    Foreign key refer to unique constraint????

    foreign key also refer to unique constraint.
    (GREAT...)

    1.then table that containt unique constraint act as master table?????
    2.IS unique constraint will replace with primary key??
    3.Is unique constraint gives all fuctionality as primary key constraint???

    thanks
    kuljeet pal singh
  • Carlos

    #2
    Re: Foreign key refer to unique constraint????

    foreign key also refer to unique constraint.
    (GREAT...)
    >
    1.then table that containt unique constraint act as master table?????
    Yes.
    2.IS unique constraint will replace with primary key??
    3.Is unique constraint gives all fuctionality as primary key constraint???
    The only diference between PK and UK (besides built-in indexes) is
    that UK can contain NULLs, whereas PK cannot. A given table could
    contain many rows with a NULL in the UK column (this is, the
    'uniqueness' affects only NOT NULL columns).

    Regards.

    Carlos.

    Comment

    • Carlos

      #3
      Re: Foreign key refer to unique constraint????

      foreign key also refer to unique constraint.
      (GREAT...)
      >
      1.then table that containt unique constraint act as master table?????
      Yes.
      2.IS unique constraint will replace with primary key??
      3.Is unique constraint gives all fuctionality as primary key constraint???
      The only diference between PK and UK (besides built-in indexes) is
      that UK can contain NULLs, whereas PK cannot. A given table could
      contain many rows with a NULL in the UK column (this is, the
      'uniqueness' affects only NOT NULL columns).

      Regards.

      Carlos.

      Comment

      • Mark D Powell

        #4
        Re: Foreign key refer to unique constraint????

        kuljeet_twtpl@h otmail.com (KULJEET) wrote in message news:<febbed51. 0401200544.7256 a5a2@posting.go ogle.com>...
        foreign key also refer to unique constraint.
        (GREAT...)
        >
        1.then table that containt unique constraint act as master table?????
        2.IS unique constraint will replace with primary key??
        3.Is unique constraint gives all fuctionality as primary key constraint???
        >
        thanks
        kuljeet pal singh
        Yes, a FK can refer to a UK or a PK. This is desirable as some table
        will have both a PK and UK on them and it may be necessary to validate
        against both.

        If this bothers you
        What is the difference between a unique index and a unique constraint?


        HTH -- Mark D Powell --

        Comment

        Working...