Guest User

Untitled

a guest
Aug 15th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. Specify sorting criteria manually for a set of records of a many-to-many relationship
  2. CREATE TABLE `isolator` (
  3. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  4. `name` varchar(127) NOT NULL,
  5. `surname` varchar(127) NOT NULL,
  6. PRIMARY KEY (`id`),
  7. );
  8.  
  9. CREATE TABLE `cell` (
  10. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  11. `name` varchar(127) NOT NULL,
  12. `gen` varchar(127) NOT NULL,
  13. PRIMARY KEY (`id`),
  14. );
  15.  
  16. CREATE TABLE `cell_isolators` (
  17. `cell_id` bigint(20) NOT NULL DEFAULT '0',
  18. `isolator_id` bigint(20) NOT NULL DEFAULT '0',
  19. PRIMARY KEY (`cell_id`,`isolator_id`),
  20. CONSTRAINT `cell_isolator_id` FOREIGN KEY (`isolator_id`) REFERENCES `isolator` (`id`),
  21. CONSTRAINT `isolator_cell_id` FOREIGN KEY (`cell_id`) REFERENCES `cell` (`id`) ON DELETE CASCADE
  22. );
Add Comment
Please, Sign In to add comment