oracle-databaseoracle-sqldeveloperoracle-sql-data-modeler

Oracle SQL developer Data modeler - composite keys


I am creating entities and am trying to create composite keys as my primary keys in the data modeler.

However I am not able to do that as I dont know how to. The question is how do I create a composite key in the data modeler.

Here is the snapshot:

le

here is the composite keys I am trying to create.

  Primary key TBD_ID + TBA_STAGE +  TBA_ASSIGNEEPNO  + TBA_STATUS   combination column, Foreign Key 
  TBD_ID

TBD_ID is the foreign key from T_BPM_Details and I want to add that to T_BPM_Assignee with the following colums to make a composite key as the primary key.

How do I do that


Solution

  • Just toggle the PK checkbox for each of the columns.

    enter image description here

    Then if you preview the DDL generated, you can see -

    CREATE TABLE composite_keys (
        key1         INTEGER NOT NULL,
        key2         INTEGER NOT NULL,
        key3         INTEGER NOT NULL,
        description  VARCHAR2(256 BYTE)
    )
    LOGGING;
    
    ALTER TABLE composite_keys
        ADD CONSTRAINT composite_keys_pk PRIMARY KEY ( key1,
                                                       key2,
                                                       key3 );