title: issue arising when one table needs to be connected with two other
body: <p>I have one table with 3 columns where booking slots are stored(bookID,bookedfrom,bookedfor).
  There is a second table which the credentials of the user are stored(crID,email,password).
  And there is a 3rd table where endusers are stored(enduserID,name,lastname)</p>
  
  <p>The aim is that the bookedfrom column of the bookingslots table references crID of the credentials table and enduserID of the endusers table.</p>
  
  <p>So we have one column referencing 2 columns in two tables respectively.</p>
  
  <p>Furthermore the endusers table references the credentials table.
  You see the point is that while the registered users of the site, their credentials will be held in the credentials table and other data such as name and last name will be held in the end users table-the bookedfrom col in the booking table will reference the crID in the credentials table-...there is the option of booking being made for non registered users,that means there will not be any entry for them in the credentials table but only entry in the endusers table and as such the bookedfrom col must also reference the andusers table.</p>
  
  <p>That being said...I am afraid we might have insertion anomalies were in the booking slots table the bookID might reference a crID of 6 AND a enduserID of 6 again.</p>
  
  <p>What do you think? Are there any problems arising with above schema...like the one mention...here is the sql code:</p>
  
  <pre><code>CREATE  TABLE IF NOT EXISTS `appointments`.`appointments` (
  `AppointId` INT NOT NULL AUTO_INCREMENT ,
  `bookedFrom` INT(11) NOT NULL ,
  `bookedFor` INT(11) NOT NULL ,
  PRIMARY KEY (`AppointId`) ,
  UNIQUE INDEX `bookedFrom_UNIQUE` (`bookedFrom` ASC) ,
  UNIQUE INDEX `bookedFor_UNIQUE` (`bookedFor` ASC) ,
  CONSTRAINT `fk_appointments_credentials1`
  FOREIGN KEY (`bookedFrom` )
  REFERENCES `appointments`.`credentials` (`crID` )
  ON DELETE CASCADE
  ON UPDATE CASCADE,
  CONSTRAINT `fk_appointments_credentials2`
  FOREIGN KEY (`bookedFor` )
  REFERENCES `appointments`.`credentials` (`crID` )
  ON DELETE CASCADE
  ON UPDATE CASCADE,
  CONSTRAINT `fk_appointments_end_users1`
  FOREIGN KEY (`bookedFrom` )
  REFERENCES `appointments`.`end_users` (`crID` )
  ON DELETE NO ACTION
  ON UPDATE NO ACTION)
  ENGINE = InnoDB
  DEFAULT CHARACTER SET = utf8
  
  CREATE  TABLE IF NOT EXISTS `appointments`.`credentials` (
  `crID` INT(11) NOT NULL AUTO_INCREMENT ,
  `email` VARCHAR(255) NULL ,
  `password` VARCHAR(100) NULL ,
  `hash` VARCHAR(32) NULL ,
  PRIMARY KEY (`crID`) ,
  UNIQUE INDEX `email_UNIQUE` (`email` ASC) )
  ENGINE = InnoDB
  AUTO_INCREMENT = 2
  DEFAULT CHARACTER SET = utf8
  
  
  CREATE  TABLE IF NOT EXISTS `appointments`.`end_users` (
  crID` INT(11) NOT NULL AUTO_INCREMENT ,
  name` VARCHAR(100) NULL DEFAULT NULL ,
  lastname` VARCHAR(100) NULL DEFAULT NULL ,
  PRIMARY KEY (`crID`) ,
  CONSTRAINT `fk_end_users_credentials1`
  FOREIGN KEY (`crID` )
  REFERENCES `appointments`.`credentials` (`crID` )
  ON DELETE NO ACTION
  ON UPDATE NO ACTION)
  ENGINE = InnoDB
  DEFAULT CHARACTER SET = utf8
  </code></pre>