0

Can anyone help me figure out why the table movie_actor cannot be created and how to fix it? I know it's the only table without a primary key, but I don't see a need for one.

create table actor
(  actor_id             int not null auto_increment,
   first_name           varchar(20),
   last_name            varchar(20),
   primary key (actor_id)
) ENGINE = InnoDB;

create table customer
(  customer_id          int not null auto_increment,
   first_name           varchar(20),
   last_name            varchar(20),
   phone_number         varchar(20),
   email                varchar(50),
   primary key(customer_id)
) ENGINE = InnoDB;

create table movie
(  movie_id             varchar(10),
   title                varchar(50),
   release_year         numeric(4,0),
   rental_duration      tinyint,
   rental_rate          numeric(2,2),
   rating               varchar(5),
   primary key (movie_id)
) ENGINE = InnoDB;

create table movie_actor
(  actor_id             varchar(10),
   movie_id             varchar(10),
   foreign key (actor_id) references actor (actor_id),
   foreign key (movie_id) references movie (movie_id)
) ENGINE = InnoDB;

create table inventory
(  inventory_id         int not null auto_increment,
   movie_id             varchar(10),
   primary key (inventory_id),
   foreign key (movie_id) references movie (movie_id)
) ENGINE = InnoDB;

create table rental
(  rental_id            int not null auto_increment,
   rental_date          date,
   inventory_id         int,
   customer_id          int,
   return_date          date,
   primary key (rental_id),
   foreign key (inventory_id) references inventory (inventory_id),
   foreign key (customer_id)  references customer (customer_id)
) ENGINE = InnoDB;

create table payment
(  payment_id           int not null auto_increment,
   customer_id          int,
   rental_id            int,
   amount               numeric(2,2),
   payment_date         date,
   primary key (payment_id),
   foreign key (customer_id) references customer (customer_id),
   foreign key (rental_id) references rental (rental_id)
) ENGINE = InnoDB;
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.