How to add foreign key "with more than one column" in SQL Power Architect In the following picture, I have a model that I'm building in SQL Power Architect:



I already have table 1 referencing a column (CDCONTR) from table 2. But I want to make the foreign key to reference two columns from table 2, I mean, both the column CDCONTR and CPF must come from table 2. How can I do this?

I'm using SQL Power Architect 1.0.7. About my RDBMS, I'm just using this power arch.
If the CPF value in TABASSASSINATES should always be the value from the related CONTRATOA table, it is redundant data.  Foreign keys won't enforce the relationship.

In other cases, the column will have applicable business rules, and you may not want to force the value in TABASSINATES to change when the CONTERATOA value is updated. The business rules won't appear in the model you have extracted above.

If it is possible to have multiple CPF values in CONTERATOA for the same CDCONTR value, the primary key should include CPF.  In this case, the foreign key relationship will include both columns. 

It is possible, but highly discouraged, to model the CONTERTOA primary key with both columns and add a unique contraint on the CDCONTR column.