SET The following tables were taken from some site when I was doing REFERENCES `doctorsoffice`.`InsuranceCompany` (`InsuranceID` ) UNIQUE INDEX `PolicyNumber_UNIQUE` (`PolicyNumber` ASC) , `PolicyNumber` smallint(5) NOT NULL AUTO_INCREMENT , `InsuranceCompany` smallint(5) NOT NULL , Table `doctorsoffice`.`PatientInsurance`ĭROP TABLE IF EXISTS `doctorsoffice`.`PatientInsurance` ĬREATE TABLE IF NOT EXISTS `doctorsoffice`.`PatientInsurance` ( ![]() UNIQUE INDEX `InsuranceID_UNIQUE` (`InsuranceID` ASC) ) `InsuranceID` smallint(5) NOT NULL AUTO_INCREMENT , Table `doctorsoffice`.`InsuranceCompany`ĭROP TABLE IF EXISTS `doctorsoffice`.`InsuranceCompany` ĬREATE TABLE IF NOT EXISTS `doctorsoffice`.`InsuranceCompany` ( REFERENCES `doctorsoffice`.`Patient` (`PatientID` ) UNIQUE INDEX `AppointmentID_UNIQUE` (`AppointmentID` ASC) , `AppointmentID` smallint(5) unsigned NOT NULL AUTO_INCREMENT , REFERENCES `doctorsoffice`.`doctor` (`DoctorID` )ĭROP TABLE IF EXISTS `doctorsoffice`.`Appointment` ĬREATE TABLE IF NOT EXISTS `doctorsoffice`.`Appointment` ( REFERENCES `doctorsoffice`.`medicalhistory` (`MedicalHistoryID` ) UNIQUE INDEX `PatientID_UNIQUE` (`PatientID` ASC) , `PrimaryPhysician` smallint(5) unsigned NOT NULL, `MedicalHistory` smallint(5) unsigned NOT NULL, ![]() `PatientID` INT unsigned NOT NULL AUTO_INCREMENT , UNIQUE INDEX `MedicalHistoryID` (`MedicalHistoryID` ASC) ,ĭROP TABLE IF EXISTS `doctorsoffice`.`Patient` ĬREATE TABLE IF NOT EXISTS `doctorsoffice`.`Patient` ( ![]() `ExistingConditions` TEXT NULL DEFAULT NULL , `MedicalHistoryID` INT(11) NOT NULL AUTO_INCREMENT , Table `doctorsoffice`.`medicalhistory`ĭROP TABLE IF EXISTS `doctorsoffice`.`medicalhistory` ĬREATE TABLE IF NOT EXISTS `doctorsoffice`.`medicalhistory` ( UNIQUE INDEX `DoctorID` (`DoctorID` ASC) , `Specialty` VARCHAR(40) NOT NULL DEFAULT 'General Practitioner' , `DoctorID` INT(11) NOT NULL AUTO_INCREMENT , SET SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES' ĬREATE SCHEMA IF NOT EXISTS `doctorsoffice` DEFAULT CHARACTER SET utf8 ĭROP TABLE IF EXISTS `doctorsoffice`.`doctor` ĬREATE TABLE IF NOT EXISTS `doctorsoffice`.`doctor` ( This is the SQL I'm using to create the tables, the two offending tables are Patient and Appointment. So I'm trying to add Foreign Key constraints to my database as a project requirement and it worked the first time or two on different tables, but I have two tables on which I get an error when trying to add the Foreign Key Constraints.ĮRROR 1215 (HY000): Cannot add foreign key constraint
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |