title: How to combine two columns as one primary key sql
body: <p>I have a database contain a table of id cards like this query</p>
  
  <pre><code>CREATE TABLE ID_CARD 
  (
      N_CARD          VARCHAR(20) NOT NULL,
      ISSUE_DATE      DATE NOT NULL,
      ID_TYPE         VARCHAR(2) NOT NULL,
      CONSTRAINT PKEY_ID_CARD PRIMARY KEY(N_CARD, ISSUE_DATE)
  );
  </code></pre>
  
  <p>but an id card can have the same <code>N_CARD</code> but with different <code>ISSUE_DATE</code> and also an id card can have the same <code>ISSUE_DATE</code> but diffrent <code>N_CARD</code> so two id cards can't have the same <code>N_CARD</code> and <code>ISSUE_DATE</code> at the same time.</p>
  
  <p>With SQL Workbench/j the SQL source for this table is </p>
  
  <pre><code>    DROP TABLE ID_CARD;
  
  CREATE CACHED TABLE ID_CARD
  (
     N_CARD      VARCHAR(20)   NOT NULL,
     ISSUE_DATE  DATE          NOT NULL,
     ID_TYPE     VARCHAR(2)    NOT NULL
  );
  
  ALTER TABLE ID_CARD
     ADD CONSTRAINT PKEY_ID_CARD
     PRIMARY KEY (N_CARD, ISSUE_DATE);
  
  CREATE UNIQUE INDEX FKEY_N_CARD_CLIENT_INDEX_8
     ON ID_CARD (N_CARD ASC);
  
  CREATE UNIQUE INDEX FKEY_ISSUE_DATE_CLIENT_INDEX_8
     ON ID_CARD (ISSUE_DATE ASC);
  </code></pre>
  
  <p>When I execute this query</p>
  
  <pre><code>INSERT INTO ID_CARD (N_CARD, ISSUE_DATE, ID_TYPE)
  VALUES ('101215', DATE '2019-11-11', 'DL');
  commit;
  INSERT INTO ID_CARD(N_CARD,ISSUE_DATE,ID_TYPE)VALUES('101215',DATE '2019-11-12','DL');
  commit;
  </code></pre>
  
  <p>this error </p>
  
  <pre><code>Unique index or primary key violation: "FKEY_N_CARD_CLIENT_INDEX_8 ON 
  
  PUBLIC.ID_CARD(N_CARD) VALUES ('101215', 9)"; SQL statement:
  INSERT INTO ID_CARD(N_CARD,ISSUE_DATE,ID_TYPE)VALUES('101215',DATE '2019-11-11','DL') [23505-193] [SQL State=23505, DB Errorcode=23505]
  </code></pre>
  
  <p>the question is how  to represent thid situation in the database ?</p>