Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE `child_birdth`( `id_child_birdth` Int NOT NULL, `cesarean_section` Enum('') NOT NULL, `start` Time NOT NULL, `the_end` Time NOT NULL,`child` Int NOT NULL, `doctor` Int NOT NULL, `mother_in_labor` Int NOT NULL, `id_child` Int NOT NULL, `id_doctor` Int NOT NULL, `id_mother_in_labor` Int NOT NULL, `id_accomodation` Int NOT NULL, `id_ward` Int NOT NULL);
- ALTER TABLE `child_birdth` ADD PRIMARY KEY (`id_child_birdth`,`id_child`,`id_doctor`,`id_mother_in_labor`,`id_accomodation`,`id_ward`);
- ALTER TABLE `child_birdth` ADD UNIQUE `id_child_birdth` (`id_child_birdth`);
- CREATE TABLE `child`( `id_child` Int NOT NULL, `gender` Char(200) NOT NULL,`date_of_birth` Datetime NOT NULL, `weight` Int NOT NULL, `growth` Int NOT NULL);
- ALTER TABLE `child` ADD PRIMARY KEY (`id_child`);
- ALTER TABLE `child` ADD UNIQUE `id_child` (`id_child`);
- CREATE TABLE `doctor`(`id_doctor` Int NOT NULL, `name` Char(50) NOT NULL,`surname` Char(50) NOT NULL, `patronymic` Char(50) NOT NULL,`date_of_birth` Datetime NOT NULL,`employment_date` Datetime NOT NULL,`salary` Int NOT NULL);
- ALTER TABLE `doctor` ADD PRIMARY KEY (`id_doctor`);
- ALTER TABLE `doctor` ADD UNIQUE `id_doctor` (`id_doctor`);
- CREATE TABLE `mother_in_labor`(`id_mother_in_labor` Int NOT NULL,`name` Char(50) NOT NULL,`surname` Char(50) NOT NULL,`patronymic` Char(50) NOT NULL,`date_of_birth` Datetime NOT NULL,`address` Varchar(200) NOT NULL,`phone` Char(13) NOT NULL,`blood_type` Enum('') NOT NULL,`ward` Int NOT NULL,`id_accomodation` Int NOT NULL,`id_ward` Int NOT NULL);
- ALTER TABLE `mother_in_labor` ADD PRIMARY KEY (`id_mother_in_labor`,`id_accomodation`,`id_ward`);
- ALTER TABLE `mother_in_labor` ADD UNIQUE `id_mother_in_labor` (`id_mother_in_labor`);
- CREATE TABLE `ward`(`id_ward` Int NOT NULL,`number_of_seats` Int NOT NULL);
- ALTER TABLE `ward` ADD PRIMARY KEY (`id_ward`);
- ALTER TABLE `ward` ADD UNIQUE `id_ward` (`id_ward`);
- CREATE TABLE `accommodation`(`id_accomodation` Int NOT NULL,`mother_in_labor` Int NOT NULL);
- ALTER TABLE `accommodation` ADD PRIMARY KEY (`id_accomodation`);
- ALTER TABLE `accommodation` ADD UNIQUE `id_accomodation` (`id_accomodation`);
- ALTER TABLE `child_birdth` ADD CONSTRAINT `Relationship1` FOREIGN KEY (`id_child`) REFERENCES `child` (`id_child`) ON DELETE RESTRICT ON UPDATE RESTRICT;
- ALTER TABLE `child_birdth` ADD CONSTRAINT `Relationship2` FOREIGN KEY (`id_doctor`) REFERENCES `doctor` (`id_doctor`) ON DELETE RESTRICT ON UPDATE RESTRICT;
- ALTER TABLE `child_birdth` ADD CONSTRAINT `Relationship3` FOREIGN KEY (`id_mother_in_labor`, `id_accomodation`, `id_ward`) REFERENCES `mother_in_labor` (`id_mother_in_labor`, `id_accomodation`, `id_ward`) ON DELETE RESTRICT ON UPDATE RESTRICT;
- ALTER TABLE `mother_in_labor` ADD CONSTRAINT `Relationship4` FOREIGN KEY (`id_accomodation`) REFERENCES `accommodation` (`id_accomodation`) ON DELETE RESTRICT ON UPDATE RESTRICT;
- ALTER TABLE `mother_in_labor` ADD CONSTRAINT `Relationship5` FOREIGN KEY (`id_ward`) REFERENCES `ward` (`id_ward`) ON DELETE RESTRICT ON UPDATE RESTRICT;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement