In my MySQL I have 3 tables like this and I have a pblm. in setting the foreign key.Pls. help
EMPLOYEE_DETAILS EMP_ID - PK int(10) EMP_FIRST_NAME varchar(25) EMP_LAST_NAME varchar(25) EMP_CURR_ADDR varchar(100) EMP_PERM_ADDR varchar(100) EMP_PHONE varchar(20) EMP_DOJ DATE EMP_DOB DATE BACKGROUND varchar(100) EMP_DEP varchar(25) EMP_DESIG varchar(25) SKILL_MASTER SKILL_ID -PK varchar(5) SKILL_DESCRIPTION varchar(25) EMPLOYEE_SKILL_DETAILS EMP_ID -FK(EMPLOYEE_DETAILS)---PK int(10) SKILL_ID -FK(SKILL_MASTER)---PK varchar(5) for a data structure of above I have the table creations like below: create table employee_details(EMP_ID int(10) not null,EMP_FIRST_NAME varchar(25), EMP_LAST_NAME varchar(25),EMP_CURR_ADDR varchar(100),EMP_PERM_ADDR varchar(100),EMP_PHONE varchar(20), EMP_DOJ DATE,EMP_DOB DATE,EMP_BACKGROUND varchar(100), EMP_DEP varchar(25), EMP_DESIG varchar(25), primary key(EMP_ID)); create table skill_master(SKILL_ID varchar(5) not null, SKILL_DESCRIPTION varchar(25), primary key(SKILL_ID)); create table employee_skill_details(EMP_ID int(10) not null references employee_details(EMP_ID), SKILL_ID varchar(5) not null references skill_master(SKILL_ID),primary key(EMP_ID,SKILL_ID)); Now based on this I should not be able to add an element to employee_skill_details table if the curresponding EMP_ID is not present in employee_details and SKILL_ID is not present in skill_master, because I have set references for it.i.e. foreign key. But still I am able to add data in employee_skill_details directly eventhough those data is not present in the other two tables. What is the problem? _____________________________________________________________ Kerala's coolest community site ---> http://www.achayans.com India's fastest growing Search Engine -> http://www.indianindex.com India's largest Online Matchmakers --> http://www.indianalliance.com _____________________________________________________________ Select your own custom email address for FREE! Get [EMAIL PROTECTED] w/No Ads, 6MB, POP & more! http://www.everyone.net/selectmail?campaign=tag --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php