Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

CREATE MULTIPLE FK

/* RENAME FK's FOR BETTER :) */
/* Name it fk_food */

  CONSTRAINT `fk_food`
    FOREIGN KEY (`food` )
    REFERENCES `mydb`.`food` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  /* Name it fk_restaurant */
  
  CONSTRAINT `fk_restaurant`
    FOREIGN KEY (`restaurant` )
    REFERENCES `mydb`.`restaurants` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION
    
    );
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #CREATE #MULTIPLE #FK
ADD COMMENT
Topic
Name
8+3 =