Results 1 to 2 of 2

Thread: Alternate Key

  1. #1
    Join Date
    Jan 2004
    Posts
    7

    Unanswered: Alternate Key

    How to use and implement alternate key
    with postgresql, like Oracle do?

    --------------------------------------------------


    T_MISSION
    =====================
    MISSION_ID (Primary Key)
    MISSION_NAME (Alternate Key)
    MISSION_INFO


    -------------------------------------------------
    OracleQL

    CREATE TABLE "T_MISSION" (
    "MISSION_ID" NUMBER(10,0) NULL,
    "MISSION_NAME" VARCHAR2(30) NOT NULL,
    "MISSION_INFO" VARCHAR(50) NULL
    );

    --------------------------------------------------

  2. #2
    Join Date
    Oct 2003
    Posts
    87

    Re: Alternate Key

    CREATE TABLE "T_MISSION" (
    "MISSION_ID" NUMBER(10,0) NOT NULL,
    "MISSION_NAME" VARCHAR2(30) NOT NULL,
    "MISSION_INFO" VARCHAR(50) NULL,
    PRIMARY KEY("MISSION_ID)
    );
    CREATE UNIQUE INDEX aaa.bbb(MISSION_NAME)
    ON aaa.T_MISSION;

    Note: PKs cannot be NULL.
    This method ensures all MISSION_IDs are unique as well as all MISSION_NAMEs, in other words, a MISSION_ID can only be associated with one MISSION_NAME.
    Oracle - DB2 - MS Access -

Posting Permissions

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