This is my Database Table which is giving Error..
Foreign key Define in more then Two columns ..
CREATE TABLE IF NOT EXISTS `EC_ATTENDEES` (
`S_ID` VARCHAR(30) NOT NULL PRIMARY KEY,
`USER_ID` VARCHAR(30) NULL ,
`TYPE` VARCHAR(30) NULL ,
`TIMETABLE_ID` VARCHAR(30) NULL ,
`COURSE_FEE` INT NULL ,
`PERMISSION` TINYINT(1) NULL ,
`PAYMENT_STATUS` VARCHAR(30) NULL ,
`BEGIN_CLASS_NUM` INT NULL ,
`END_CLASS_NUM` INT NULL ,
FOREIGN KEY (`USER_ID` ) REFERENCES `EC_USER` (`S_ID` ),
FOREIGN KEY (`BEGIN_CLASS_NUM` ) REFERENCES `EC_TIMETABLE` (`S_ID` ),
FOREIGN KEY (`END_CLASS_NUM` ) REFERENCES `EC_TIMETABLE` (`S_ID` ),
FOREIGN KEY (`TIMETABLE_ID` ) REFERENCES `EC_TIMETABLE` (`S_ID` ));
It’s probably because the type of one of the foreign key columns doesn’t match the type of the referenced column. Two of your columns mentioned in the foreign keys (
BEGIN_CLASS_NUMandEND_CLASS_NUM) have typeINT, and the other one (TIMETABLE_ID) has typeVARCHAR(30). The referenced column (S_ID) can only possibly be one of the two, so either one or two of the foreign keys will generate errors.