|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Foreign Key
hi guys,
i need some help. i have 3 tables m_dept_hdr, m_dept_dtl and m_employee. m_dept_hdr: dept_id /* primary key */ dept_name m_dept_dtl: dept_id /* primary key */ empid /* primary key, this is for employee id */ m_employee: empid /* primary key */ empname i want the m_dept_hdr.dept_id and m_employee.empid to be the foreign key in m_dept_dtl... does anybody help me on how to code this... i tried alter table m_dept_dtl add constraint fk_dept_id foreign key (dept_id) references m_dept_hdr(dept_id) on delete restrict on update restrict alter table m_dept_dtl add constraint fk_empid foreign key(empid) references m_employee (empid) on delete restrict on update restrict but the second alter table in setting the empid to be the foreign key does not work... please help me... thanks... ![]() |
|
#2
|
|||
|
|||
|
hi guys,
i solve the problem... i was not able to set the dept_id and empid to be index... thanks anyway... ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Foreign Key |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|