Database schema:

CREATE TABLE actors (
	actorid INTEGER NOT NULL -- example: ['16', '4'],
	a_gender TEXT NOT NULL -- example: ['M', 'F'],
	a_quality INTEGER NOT NULL -- example: ['0', '4'],
	PRIMARY KEY (actorid)
)


CREATE TABLE directors (
	directorid INTEGER NOT NULL -- example: ['7387', '12945'],
	d_quality INTEGER NOT NULL -- example: ['0', '1'],
	avg_revenue INTEGER NOT NULL -- example: ['0', '1'],
	PRIMARY KEY (directorid)
)


CREATE TABLE movies (
	movieid INTEGER DEFAULT 0 NOT NULL -- example: ['1672052', '1672111'],
	year INTEGER NOT NULL -- example: ['4', '3'],
	"isEnglish" TEXT NOT NULL -- example: ['F', 'T'],
	country TEXT NOT NULL -- example: ['other', 'USA'],
	runningtime INTEGER NOT NULL -- example: ['2', '3'],
	PRIMARY KEY (movieid)
)


CREATE TABLE movies2actors (
	movieid INTEGER NOT NULL -- example: ['1672052', '1672111'],
	actorid INTEGER NOT NULL -- example: ['88796', '88848'],
	cast_num INTEGER NOT NULL -- example: ['0', '1'],
	PRIMARY KEY (movieid, actorid), 
	CONSTRAINT fk_movies2actors_actors FOREIGN KEY(actorid) REFERENCES actors (actorid),
	CONSTRAINT fk_movies2actors_movies FOREIGN KEY(movieid) REFERENCES movies (movieid)
)


CREATE TABLE movies2directors (
	movieid INTEGER NOT NULL -- example: ['1672052', '1672111'],
	directorid INTEGER NOT NULL -- example: ['54934', '22397'],
	genre TEXT NOT NULL -- example: ['Adventure', 'Action'],
	PRIMARY KEY (movieid, directorid), 
	CONSTRAINT fk_movies2directors_directors FOREIGN KEY(directorid) REFERENCES directors (directorid),
	CONSTRAINT fk_movies2directors_movies FOREIGN KEY(movieid) REFERENCES movies (movieid)
)


CREATE TABLE u2base (
	userid INTEGER DEFAULT 0 NOT NULL -- example: ['2', '1'],
	movieid INTEGER NOT NULL -- example: ['1684486', '1685309'],
	rating TEXT NOT NULL -- example: ['2', '1'],
	PRIMARY KEY (userid, movieid), 
	CONSTRAINT fk_u2base_movies FOREIGN KEY(movieid) REFERENCES movies (movieid),
	CONSTRAINT fk_u2base_users FOREIGN KEY(userid) REFERENCES users (userid)
)


CREATE TABLE users (
	userid INTEGER DEFAULT 0 NOT NULL -- example: ['2', '1'],
	age TEXT NOT NULL -- example: ['1', '56'],
	u_gender TEXT NOT NULL -- example: ['M', 'F'],
	occupation TEXT NOT NULL -- example: ['2', '3'],
	PRIMARY KEY (userid)
)

Question: How many horror movies were made by the worst directors?
Evidence: d_quality = 5 refers to direct the best, d_quality = 0 refers to direct the worst

SQL:
SELECT COUNT(T1.movieid) FROM movies2directors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid INNER JOIN directors AS T3 ON T1.directorid = T3.directorid WHERE T1.genre = 'horror' AND T3.d_quality = 0