0
Completed

foreign keys as primary keys

nickstavrou 3 years ago updated by saiteja.hara 3 months ago 4

How we add this to a many to many table?
got it somehow in one table by luck but its not at all obvious how to do it..
make a tutorial for that please.

Answer

Answer
Completed

Dear User,

I agree that there should be a knowledge base article, which we added. 

https://support.sqldbm.com/knowledge-bases/2/articles/746-how-to-add-many-to-many-relationship


Here is the solution to your question:


- First create two main tables with all required columns, and then add third table (which is essentially empty [no columns]).

- Now add relationships from both main tables to this table as shown in following image. To add identifying relationship (foreign key as primary key) hold CTRL button when creating reference.



Feel free to contact us in case you have further questions.


Thanks,

Team - SqlDBM

Answer
Completed

Dear User,

I agree that there should be a knowledge base article, which we added. 

https://support.sqldbm.com/knowledge-bases/2/articles/746-how-to-add-many-to-many-relationship


Here is the solution to your question:


- First create two main tables with all required columns, and then add third table (which is essentially empty [no columns]).

- Now add relationships from both main tables to this table as shown in following image. To add identifying relationship (foreign key as primary key) hold CTRL button when creating reference.



Feel free to contact us in case you have further questions.


Thanks,

Team - SqlDBM

+1

I was looking to do exactly this, but I'm afraid holding Ctrl doesn't seem to do the trick. Has this changed in the last two years? I've tried both on Chromium and Edge.

The working of 'holding CTRL'  might've been changed to a different function, it creates a new table with FK parameters set. Instead, you can just drag-drop the FK into the PK (upper division of the table) when the table is "just selected or highlighted" (not in the edit mode).