Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have created at 2 tables. These tables are Department, employee.

Now i want to assign foreign key in department table and join with employee table.

have any idea??

SELECT id,department FROM department; 
SELECT * FROM `employee'
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
281 views
Welcome To Ask or Share your Answers For Others

1 Answer

create employee table field are- id(primary key),name,dept_id
department table fields are-dept_id(primary key),name

after select the dept_id.give index. enter image description here

than select the department table and dept_id.than click save button. enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...