CREATE TABLE `vn`.`entryObservation` ( id int NOT NULL AUTO_INCREMENT, entryFk int NOT NULL, observationTypeFk TINYINT(3) UNSIGNED, description TEXT, PRIMARY KEY (id), CONSTRAINT entry_id_entryFk FOREIGN KEY (entryFk) REFERENCES entry(id), CONSTRAINT observationType_id_observationTypeFk FOREIGN KEY (observationTypeFk) REFERENCES observationType(id) ); ALTER TABLE `vn`.`entryObservation` ADD UNIQUE INDEX `entryFk_observationTypeFk_UNIQUE` (`entryFk` ASC,`observationTypeFk` ASC);