Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. class Person {
  2. String name;
  3. String surname;
  4. List<String> phones;
  5. }
  6.  
  7. Tables:
  8. `phone`
  9. (
  10. `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  11. `owner` INT UNSIGNED NOT NULL,
  12. `number` VARCHAR(50) NOT NULL,
  13. CONSTRAINT `PK_phone` PRIMARY KEY (`id`)
  14. )
  15. `person`
  16. (
  17. `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  18. `surname` VARCHAR(150) NOT NULL,
  19. `name` VARCHAR(150) NOT NULL,
  20. CONSTRAINT `PK_phonebook` PRIMARY KEY (`id`)
  21. )
  22. ALTER TABLE `phone`
  23. ADD CONSTRAINT `FK_phone_person`
  24. FOREIGN KEY (`owner`) REFERENCES `person` (`id`) ON DELETE Cascade ON UPDATE Cascade
  25. ;
  26. SET FOREIGN_KEY_CHECKS=1 ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement