Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2015
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.54 KB | None | 0 0
  1. CREATE TABLE IF NOT EXISTS `mydb`.`properties_posts_rel` (
  2.   `post_id` INT UNSIGNED NOT NULL,
  3.   `property_id` INT UNSIGNED NOT NULL,
  4.   PRIMARY KEY (`post_id`, `property_id`),
  5.   INDEX `rel_property_idx` (`property_id` ASC),
  6.   CONSTRAINT `rel_property`
  7.     FOREIGN KEY (`property_id`)
  8.     REFERENCES `mydb`.`properties` (`property_id`)
  9.     ON DELETE NO ACTION
  10.     ON UPDATE NO ACTION,
  11.   CONSTRAINT `rel_post`
  12.     FOREIGN KEY (`post_id`)
  13.     REFERENCES `mydb`.`posts` (`post_id`)
  14.     ON DELETE NO ACTION
  15.     ON UPDATE NO ACTION)
  16. ENGINE = InnoDB;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement