Query around Primary Key in Appian My SQL Database

Hi All,

 

I am working on version 18.1.

 

I have a few queries around Primary Key in Appian's MY SQL database:

 

1. In my MySQL database, if I want to create two columns as primary key i.e. if I want to create a composite key rather than making just one column as a primary key then how can I do that as in my data type Appian allows to create only one column as primary key though in XSD we can add two columns as primary key using @Id annotation. So I would like to know how can I achieve this or I can only create one column as primary key.

2. Also would like to know in which scenario do I get Unique Key Constraint violated error.

 

Thanks in advance!!

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer
    hi
    if you are sure that the 2 column will make unique combination. then no need to declare primary key.
    in database table only one column can be primary key (if you define).

    instead, just declare column as other columns
    and at the time of query use 2 filters combination with AND.

    if you declare primary key that means its values must be unique otherwise you will get error.
Reply
  • 0
    Certified Senior Developer
    hi
    if you are sure that the 2 column will make unique combination. then no need to declare primary key.
    in database table only one column can be primary key (if you define).

    instead, just declare column as other columns
    and at the time of query use 2 filters combination with AND.

    if you declare primary key that means its values must be unique otherwise you will get error.
Children