
CREATE TABLE "Movie" (
	"mID" INTEGER, 
	title TEXT, 
	year INTEGER, 
	director TEXT, 
	PRIMARY KEY ("mID")
)


CREATE TABLE "Rating" (
	"rID" INTEGER, 
	"mID" INTEGER, 
	stars INTEGER, 
	"ratingDate" DATE, 
	FOREIGN KEY("mID") REFERENCES "Movie" ("mID"), 
	FOREIGN KEY("rID") REFERENCES "Reviewer" ("rID")
)


CREATE TABLE "Reviewer" (
	"rID" INTEGER, 
	name TEXT, 
	PRIMARY KEY ("rID")
)

CREATE TABLE "Movie" (
	"mID" INTEGER, 
	title TEXT, 
	year INTEGER, 
	director TEXT, 
	PRIMARY KEY ("mID")
)

/*
2 rows from Movie table:
mID	title	year	director
101	Gone with the Wind	1939	Victor Fleming
102	Star Wars	1977	George Lucas
*/


CREATE TABLE "Rating" (
	"rID" INTEGER, 
	"mID" INTEGER, 
	stars INTEGER, 
	"ratingDate" DATE, 
	FOREIGN KEY("mID") REFERENCES "Movie" ("mID"), 
	FOREIGN KEY("rID") REFERENCES "Reviewer" ("rID")
)

/*
2 rows from Rating table:
rID	mID	stars	ratingDate
201	101	2	2011-01-22
201	101	4	2011-01-27
*/


CREATE TABLE "Reviewer" (
	"rID" INTEGER, 
	name TEXT, 
	PRIMARY KEY ("rID")
)

/*
2 rows from Reviewer table:
rID	name
201	Sarah Martinez
202	Daniel Lewis
*/
For all directors who directed more than one movie, return the titles of all movies directed by them, along with the director name. Sort by director name, then movie title.
SELECT T1.title ,  T1.director FROM Movie AS T1 JOIN Movie AS T2 ON T1.director  =  T2.director WHERE T1.title != T2.title ORDER BY T1.director ,  T1.title
[{'title': 'Avatar', 'director': 'James Cameron'}, {'title': 'Titanic', 'director': 'James Cameron'}, {'title': 'E.T.', 'director': 'Steven Spielberg'}, {'title': 'Raiders of the Lost Ark', 'director': 'Steven Spielberg'}]