I have a certain problem, while creating logical/relational model of database. I get duplicate foreign key in a table. This table is referencing 2 other tables, thorugh identyfing relationship, which reference this particular key and they have to be primary keys because they are cross-reference tables. Something like this:

enter image description here

How can i fix this so i don't have duplicate keys on PARAM_VAL: id_quali1 and id_quali?

  • Can you please add more details to your database schema? For example, I don't see id_quali1 used anywhere and therefor don't understand how it can be duplicated. More descriptive names of your tables and columns would also help paint a picture.
    – J.D.
    Jan 16, 2021 at 16:41
  • id_quali1 is just a name to point out that it is dupliacate (of id_quali but from different table), because identyfing relationships take it from the parent table. After some thought i think it can't be done differently so ill just leave 2 of them id_quali_quali_participation and id_quali_param_weight and ill check if both of them are equal when insterting. Jan 16, 2021 at 17:49

2 Answers 2


Like @J.D. mentions in his comment it is not obvious what problem you are trying to solve. If I were to guess PARAM_VAL could be consructed as:

CREATE TABLE param_val
( id_quali ... NOT NULL
, id_param ... NOT NULL
, id_cand ... NOT NULL
, PRIMARY KEY (id_quali, id_param, id_cand) -- I guess
, FOREIGN KEY (id_quali, id_param) 
      REFERENCES param_weight(id_quali, id_param)
, FOREIGN KEY (id_quali, id_cand) 
      REFERENCES quali_participation(id_quali, id_cand)
  • the thing is Oracle data modeler doesn't let me delete id_quali1 (the name is just a duplicate id_quali, it does not exist in database) Jan 16, 2021 at 17:53
  • @BartoszLeszczyński What error do you encounter if you try to remove it?
    – J.D.
    Jan 16, 2021 at 18:24
  • i cannot delete it from gui when i operate on relational model in Oracle SQL Developer Data Modeler, when i click on delete column it doesn't change anything Jan 16, 2021 at 18:35
  • What if you create my table above but name it param_val_test and reverse engineer it into the modeller? Jan 16, 2021 at 18:39
  • 1
    @BartoszLeszczyński Time to find another tool.
    – user212533
    Jan 16, 2021 at 21:53

I know this is an old thread but I've been struggling with the same problem myself and have just solved it, so thought I'd share.

  • In the Relational Model, double click the foreign key that joins PARAM_VAL to QUALI_PARTICIPATION. The Foreign Key Properties dialog will open.
  • Under "General" you will see the offending column id_quali1, which references id_quali from the QUALI_PARTICIPATION table.
  • Click on id_quali1. A select list of columns in the PARAM_VAL table will open.
  • Select id_quali and cick OK.
  • In response to 'Do you want to delete generated FK columns "id_quali1"?', click Yes.

The duplicate column will be gone.

Unfortunately you'll have to repeat the process if you ever re-engineer the Relational Model from the Logical Model.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.