CREATE TABLE Genre (
	genre varchar(25) NOT NULL,
	action bool,
	horror bool,
	comedy bool,
	suspense bool,
	adventure bool,
	crime bool,
	fiction bool,
	animated bool,
	PRIMARY KEY (genre)
);

CREATE TABLE Films (
	films_id char(8) NOT NULL,
	title varchar(25),
	description varchar(255),
	duration varchar(4),
	reviews int,
	genre varchar(25) NOT NULL,
	PRIMARY KEY (films_id),
	FOREIGN KEY (genre) REFERENCES Genre(genre)
);

CREATE TABLE Actors (
	actor_id char(8) NOT NULL,
	name varchar(20),
	gender CHAR,
	age int,
	bio varchar(255),
	PRIMARY KEY (actor_id)
);

CREATE TABLE Directors (
	director_id char(8) NOT NULL,
	name varchar(20),
	gender CHAR,
	age int,
	bio varchar(255),
	PRIMARY KEY (director_id)	
);

CREATE TABLE Actor_has_films (
	actor_id char(8) NOT NULL,
	films_id char(8) NOT NULL,
	PRIMARY KEY (actor_id, films_id),
	FOREIGN KEY (actor_id) REFERENCES Actors(actor_id),
	FOREIGN KEY (films_id) REFERENCES Films(films_id)
);

CREATE TABLE Genre_has_films (
	genre varchar(25) NOT NULL,
	films_id char(8) NOT NULL,
	PRIMARY KEY (genre, films_id),
	FOREIGN KEY (genre) REFERENCES Genre(genre),
	FOREIGN KEY (films_id) REFERENCES Films(films_id)
);

CREATE TABLE Directs (
	films_id char(8) NOT NULL,
	director_id char(8) NOT NULL,
	PRIMARY KEY (films_id, director_id),
	FOREIGN KEY (films_id) REFERENCES Films(films_id),
	FOREIGN KEY (director_id) REFERENCES Director(director_id)
);

