Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.89 KB | None | 0 0
  1. CREATE database `Movies`;
  2. CREATE TABLE `directors`(
  3. `id` int not null auto_increment PRIMARY KEY,
  4. `director_name` VARCHAR(50) not null,
  5. `notes` VARCHAR(200)
  6. );
  7.  
  8. CREATE TABLE `genres`(
  9. `id` int not null auto_increment PRIMARY KEY,
  10. `genre_name` VARCHAR(50) not null,
  11. `notes` VARCHAR(200)
  12. );
  13.  
  14. CREATE TABLE `categories`(
  15. `id` int not null auto_increment PRIMARY KEY,
  16. `category_name`    VARCHAR(50) not null,
  17. `notes` VARCHAR(200)
  18. );
  19.  
  20. CREATE TABLE `movies`(
  21. `id` int not null auto_increment PRIMARY KEY,
  22. `title` VARCHAR(50) not null,
  23. `director_id` int not null,
  24. `copyright_year` date,
  25. `length` int,
  26. `genre_id` int not null,
  27. `category_id` int not null,
  28. `rating` int,
  29. `notes` VARCHAR(200),
  30. CONSTRAINT  FOREIGN KEY (`director_id`) REFERENCES `directors`(`id`),
  31. CONSTRAINT  FOREIGN KEY (`genre_id`) REFERENCES `genres`(`id`),
  32. CONSTRAINT  FOREIGN KEY (`category_id`) REFERENCES `categories`(`id`)
  33. );
  34.  
  35. INSERT INTO `directors` (`id`,`director_name`,`notes`)
  36. VALUES ('1','palio',null),
  37. ('2','gosho',null),
  38. ('3','bai ivan',null),
  39. ('4','stamat',null),
  40. ('5','avera na stamat',null);
  41.  
  42. INSERT INTO `genres` (`id`,`genre_name`,`notes`)
  43. VALUES ('1','Comedy',null),
  44. ('2','Drama',null),
  45. ('3','Action',null),
  46. ('4','Action-comedy',null),
  47. ('5','Comedy-action-thriller-horror',null);
  48.  
  49. INSERT INTO `categories` (`id`,`category_name`,`notes`)
  50. VALUES ('1','hard to watch',null),
  51. ('2','best seller',null),
  52. ('3','medium',null),
  53. ('4','asdf',null),
  54. ('5','random',null);
  55.  
  56. INSERT INTO `movies` (`id`, `title`, `director_id`, `copyright_year`, `length`, `genre_id`, `category_id`, `rating`, `notes`)
  57. VALUES ('1','ANTMAN','2',null,null,'4','2',null,null),
  58. ('2','Avatar the last airbender 2011','3',null,null,'2','1',null,null),
  59. ('3','Back to the Future 1','4',null,null,'5','2',null,null),
  60. ('4','Back to the Future 2','4',null,null,'4','2',null,null),
  61. ('5','Back to the Future 3','5',null,null,'1','2',null,null);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement