Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE database `Movies`;
- CREATE TABLE `directors`(
- `id` int not null auto_increment PRIMARY KEY,
- `director_name` VARCHAR(50) not null,
- `notes` VARCHAR(200)
- );
- CREATE TABLE `genres`(
- `id` int not null auto_increment PRIMARY KEY,
- `genre_name` VARCHAR(50) not null,
- `notes` VARCHAR(200)
- );
- CREATE TABLE `categories`(
- `id` int not null auto_increment PRIMARY KEY,
- `category_name` VARCHAR(50) not null,
- `notes` VARCHAR(200)
- );
- CREATE TABLE `movies`(
- `id` int not null auto_increment PRIMARY KEY,
- `title` VARCHAR(50) not null,
- `director_id` int not null,
- `copyright_year` date,
- `length` int,
- `genre_id` int not null,
- `category_id` int not null,
- `rating` int,
- `notes` VARCHAR(200),
- CONSTRAINT FOREIGN KEY (`director_id`) REFERENCES `directors`(`id`),
- CONSTRAINT FOREIGN KEY (`genre_id`) REFERENCES `genres`(`id`),
- CONSTRAINT FOREIGN KEY (`category_id`) REFERENCES `categories`(`id`)
- );
- INSERT INTO `directors` (`id`,`director_name`,`notes`)
- VALUES ('1','palio',null),
- ('2','gosho',null),
- ('3','bai ivan',null),
- ('4','stamat',null),
- ('5','avera na stamat',null);
- INSERT INTO `genres` (`id`,`genre_name`,`notes`)
- VALUES ('1','Comedy',null),
- ('2','Drama',null),
- ('3','Action',null),
- ('4','Action-comedy',null),
- ('5','Comedy-action-thriller-horror',null);
- INSERT INTO `categories` (`id`,`category_name`,`notes`)
- VALUES ('1','hard to watch',null),
- ('2','best seller',null),
- ('3','medium',null),
- ('4','asdf',null),
- ('5','random',null);
- INSERT INTO `movies` (`id`, `title`, `director_id`, `copyright_year`, `length`, `genre_id`, `category_id`, `rating`, `notes`)
- VALUES ('1','ANTMAN','2',null,null,'4','2',null,null),
- ('2','Avatar the last airbender 2011','3',null,null,'2','1',null,null),
- ('3','Back to the Future 1','4',null,null,'5','2',null,null),
- ('4','Back to the Future 2','4',null,null,'4','2',null,null),
- ('5','Back to the Future 3','5',null,null,'1','2',null,null);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement