Click here to Skip to main content
14,695,085 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I was using the insert query when I faced a problem , I want to insert the foreign key , for example :

I want to insert the employee's ID in the job table where the employee's name is "XYZ" in the employees table,

I tried to select from the employees table the ID where the name is "XYZ" then insert it in the job table.

Is this a right way or what can I do else?

Thanks in advance.

1 solution

As far as I know, this way is fine.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900