0
Answered

Made a foreign key, but this relationship is not shown in SQL preview

le_univers 5 years ago updated by Rafał Strzaliński (Senior Engineer) 5 years ago 1

Apology if this is too basic, but I'm really new to everything and struggling.

So I know how to make a foreign key 

: When there are 2 entities, A and B, you draw a reference from A to B and voila,

the primary keys of A are shown in the B entity boxes as foreign keys, with some names like "A_id".

But when I actually check the SQL preview of B, I don't see any such information as that this data is coming from A.

Am I missing something? How can I make a SQL code like below show up?


PRIMARY KEY (sid, cid), FOREIGN KEY (sid) REFERENCES Students

Answered

Hi,

Vertabelo generates relationships as "ALTER TABLE ADD CONSTRAINT ...." statements. Click on the relationship line to see details, and click "SQL Preview" to see that statement.

Hope it helps. If you have any questions please do not hesitate to contact us.