/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; DROP TABLE IF EXISTS `editions`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `editions` ( `Id` int(11) NOT NULL, `Title` varchar(45) NOT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `editions` WRITE; /*!40000 ALTER TABLE `editions` DISABLE KEYS */; INSERT INTO `editions` VALUES (1,'Some Book First Edition'),(2,'Another Book First Edition'),(3,'Another Book Second Edition'),(4,'Another Book Third Edition'); /*!40000 ALTER TABLE `editions` ENABLE KEYS */; UNLOCK TABLES; DROP TABLE IF EXISTS `books`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `books` ( `Id` int(11) NOT NULL, `AuthorId` int(11) NOT NULL, PRIMARY KEY (`Id`), KEY `fk_authors_books` (`AuthorId`), CONSTRAINT `fk_authors_books` FOREIGN KEY (`AuthorId`) REFERENCES `authors` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `books` WRITE; /*!40000 ALTER TABLE `books` DISABLE KEYS */; INSERT INTO `books` VALUES (8,1),(9,1); /*!40000 ALTER TABLE `books` ENABLE KEYS */; UNLOCK TABLES; DROP TABLE IF EXISTS `editionsinbooks`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `editionsinbooks` ( `BookId` int(11) NOT NULL, `EditionId` int(11) NOT NULL, PRIMARY KEY (`BookId`,`EditionId`), KEY `fk1` (`BookId`), KEY `fk2` (`EditionId`), CONSTRAINT `fk1` FOREIGN KEY (`BookId`) REFERENCES `books` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk2` FOREIGN KEY (`EditionId`) REFERENCES `editions` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `editionsinbooks` WRITE; /*!40000 ALTER TABLE `editionsinbooks` DISABLE KEYS */; INSERT INTO `editionsinbooks` VALUES (8,1),(9,2),(9,3),(9,4); /*!40000 ALTER TABLE `editionsinbooks` ENABLE KEYS */; UNLOCK TABLES; DROP TABLE IF EXISTS `authors`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `authors` ( `Id` int(11) NOT NULL, `Name` varchar(45) NOT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; LOCK TABLES `authors` WRITE; /*!40000 ALTER TABLE `authors` DISABLE KEYS */; INSERT INTO `authors` VALUES (1,'Some Author'),(2,'Another Author'); /*!40000 ALTER TABLE `authors` ENABLE KEYS */; UNLOCK TABLES; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;