lianghsun/spider-text2sql-bench huggingface dataset:
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
What are the first and last names of the first-grade students who are NOT taught by teacher OTHA MOYER?

### SQL
SELECT DISTINCT T1.firstname ,  T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom  =  T2.classroom WHERE T1.grade  =  1 EXCEPT SELECT T1.firstname ,  T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom  =  T2.classroom WHERE T2.firstname  =  "OTHA" AND T2.lastname  =  "MOYER"
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
Find the last names of the students in third grade that are not taught by COVIN JEROME.

### SQL
SELECT DISTINCT T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom  =  T2.classroom WHERE T1.grade  =  3 AND T2.firstname != "COVIN" AND T2.lastname != "JEROME"
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
Which students in third grade are not taught by teacher COVIN JEROME? Give me the last names of the students.

### SQL
SELECT DISTINCT T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom  =  T2.classroom WHERE T1.grade  =  3 AND T2.firstname != "COVIN" AND T2.lastname != "JEROME"
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
For each grade, report the grade, the number of classrooms in which it is taught and the total number of students in the grade.

### SQL
SELECT grade ,  count(DISTINCT classroom) ,  count(*) FROM list GROUP BY grade
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
For each grade, return the grade number, the number of classrooms used for the grade, and the total number of students enrolled in the grade.

### SQL
SELECT grade ,  count(DISTINCT classroom) ,  count(*) FROM list GROUP BY grade
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
For each classroom, report the classroom number and the number of grades using it.

### SQL
SELECT classroom ,  count(DISTINCT grade) FROM list GROUP BY classroom
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
For each classroom, show the classroom number and count the number of distinct grades that use the room.

### SQL
SELECT classroom ,  count(DISTINCT grade) FROM list GROUP BY classroom
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
Which classroom has the most students?

### SQL
SELECT classroom FROM list GROUP BY classroom ORDER BY count(*) DESC LIMIT 1
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
Find the classroom that the most students use.

### SQL
SELECT classroom FROM list GROUP BY classroom ORDER BY count(*) DESC LIMIT 1
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
Report the number of students in each classroom.

### SQL
SELECT classroom ,  count(*) FROM list GROUP BY classroom
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
For each classroom, show the classroom number and find how many students are using it.

### SQL
SELECT classroom ,  count(*) FROM list GROUP BY classroom
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
For each grade 0 classroom, report the total number of students.

### SQL
SELECT classroom ,  count(*) FROM list WHERE grade  =  "0" GROUP BY classroom
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
For each grade 0 classroom, return the classroom number and the count of students.

### SQL
SELECT classroom ,  count(*) FROM list WHERE grade  =  "0" GROUP BY classroom
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
Report the total number of students for each fourth-grade classroom.

### SQL
SELECT classroom ,  count(*) FROM list WHERE grade  =  "4" GROUP BY classroom
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
For each fourth-grade classroom, show the classroom number and the total number of students using it.

### SQL
SELECT classroom ,  count(*) FROM list WHERE grade  =  "4" GROUP BY classroom
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
Find the name of the teacher who teaches the largest number of students.

### SQL
SELECT T2.firstname ,  T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom  =  T2.classroom GROUP BY T2.firstname ,  T2.lastname ORDER BY count(*) DESC LIMIT 1
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
Which teacher teaches the most students? Give me the first name and last name of the teacher.

### SQL
SELECT T2.firstname ,  T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom  =  T2.classroom GROUP BY T2.firstname ,  T2.lastname ORDER BY count(*) DESC LIMIT 1
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
Find the number of students in one classroom.

### SQL
SELECT count(*) ,  classroom FROM list GROUP BY classroom
### Database Schema
CREATE TABLE "list" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Grade" INTEGER, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

CREATE TABLE "teachers" ( 
	"LastName" TEXT, 
	"FirstName" TEXT, 
	"Classroom" INTEGER,
	PRIMARY KEY(LastName, FirstName)
)

### Question
How many students does one classroom have?

### SQL
SELECT count(*) ,  classroom FROM list GROUP BY classroom
### Database Schema
CREATE TABLE "people" (
    "People_ID" int,
    "Age" int,
    "Name" text,
    "Nationality" text,
    "Graduation_College" text,
    PRIMARY KEY ("People_ID")
)

CREATE TABLE "company" (
    "Company_ID" real,
    "Name" text,
    "Headquarters" text,
    "Industry" text,
    "Sales_in_Billion" real,
    "Profits_in_Billion" real,
    "Assets_in_Billion" real,
    "Market_Value_in_Billion" real,
    PRIMARY KEY ("Company_ID")
)

CREATE TABLE "employment" (
    "Company_ID" int,
    "People_ID" int,
    "Year_working" int,
    PRIMARY KEY ("Company_ID","People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
    FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)

### Question
How many companies are headquartered in the US?

### SQL
SELECT count(*) FROM company WHERE Headquarters  =  'USA'
### Database Schema
CREATE TABLE "people" (
    "People_ID" int,
    "Age" int,
    "Name" text,
    "Nationality" text,
    "Graduation_College" text,
    PRIMARY KEY ("People_ID")
)

CREATE TABLE "company" (
    "Company_ID" real,
    "Name" text,
    "Headquarters" text,
    "Industry" text,
    "Sales_in_Billion" real,
    "Profits_in_Billion" real,
    "Assets_in_Billion" real,
    "Market_Value_in_Billion" real,
    PRIMARY KEY ("Company_ID")
)

CREATE TABLE "employment" (
    "Company_ID" int,
    "People_ID" int,
    "Year_working" int,
    PRIMARY KEY ("Company_ID","People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
    FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)

### Question
List the names of companies by ascending number of sales.

### SQL
SELECT Name FROM company ORDER BY Sales_in_Billion ASC
### Database Schema
CREATE TABLE "people" (
    "People_ID" int,
    "Age" int,
    "Name" text,
    "Nationality" text,
    "Graduation_College" text,
    PRIMARY KEY ("People_ID")
)

CREATE TABLE "company" (
    "Company_ID" real,
    "Name" text,
    "Headquarters" text,
    "Industry" text,
    "Sales_in_Billion" real,
    "Profits_in_Billion" real,
    "Assets_in_Billion" real,
    "Market_Value_in_Billion" real,
    PRIMARY KEY ("Company_ID")
)

CREATE TABLE "employment" (
    "Company_ID" int,
    "People_ID" int,
    "Year_working" int,
    PRIMARY KEY ("Company_ID","People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
    FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)

### Question
What are the headquarters and industries of all companies?

### SQL
SELECT Headquarters ,  Industry FROM company
### Database Schema
CREATE TABLE "people" (
    "People_ID" int,
    "Age" int,
    "Name" text,
    "Nationality" text,
    "Graduation_College" text,
    PRIMARY KEY ("People_ID")
)

CREATE TABLE "company" (
    "Company_ID" real,
    "Name" text,
    "Headquarters" text,
    "Industry" text,
    "Sales_in_Billion" real,
    "Profits_in_Billion" real,
    "Assets_in_Billion" real,
    "Market_Value_in_Billion" real,
    PRIMARY KEY ("Company_ID")
)

CREATE TABLE "employment" (
    "Company_ID" int,
    "People_ID" int,
    "Year_working" int,
    PRIMARY KEY ("Company_ID","People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
    FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)

### Question
Show the names of companies in the banking or retailing industry?

### SQL
SELECT Name FROM company WHERE Industry  =  "Banking" OR Industry  =  "Retailing"
### Database Schema
CREATE TABLE "people" (
    "People_ID" int,
    "Age" int,
    "Name" text,
    "Nationality" text,
    "Graduation_College" text,
    PRIMARY KEY ("People_ID")
)

CREATE TABLE "company" (
    "Company_ID" real,
    "Name" text,
    "Headquarters" text,
    "Industry" text,
    "Sales_in_Billion" real,
    "Profits_in_Billion" real,
    "Assets_in_Billion" real,
    "Market_Value_in_Billion" real,
    PRIMARY KEY ("Company_ID")
)

CREATE TABLE "employment" (
    "Company_ID" int,
    "People_ID" int,
    "Year_working" int,
    PRIMARY KEY ("Company_ID","People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
    FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)

### Question
What is the maximum and minimum market value of companies?

### SQL
SELECT max(Market_Value_in_Billion) ,  min(Market_Value_in_Billion) FROM company
### Database Schema
CREATE TABLE "people" (
    "People_ID" int,
    "Age" int,
    "Name" text,
    "Nationality" text,
    "Graduation_College" text,
    PRIMARY KEY ("People_ID")
)

CREATE TABLE "company" (
    "Company_ID" real,
    "Name" text,
    "Headquarters" text,
    "Industry" text,
    "Sales_in_Billion" real,
    "Profits_in_Billion" real,
    "Assets_in_Billion" real,
    "Market_Value_in_Billion" real,
    PRIMARY KEY ("Company_ID")
)

CREATE TABLE "employment" (
    "Company_ID" int,
    "People_ID" int,
    "Year_working" int,
    PRIMARY KEY ("Company_ID","People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
    FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)

### Question
What is the headquarter of the company with the largest sales?

### SQL
SELECT Headquarters FROM company ORDER BY Sales_in_Billion DESC LIMIT 1
### Database Schema
CREATE TABLE "people" (
    "People_ID" int,
    "Age" int,
    "Name" text,
    "Nationality" text,
    "Graduation_College" text,
    PRIMARY KEY ("People_ID")
)

CREATE TABLE "company" (
    "Company_ID" real,
    "Name" text,
    "Headquarters" text,
    "Industry" text,
    "Sales_in_Billion" real,
    "Profits_in_Billion" real,
    "Assets_in_Billion" real,
    "Market_Value_in_Billion" real,
    PRIMARY KEY ("Company_ID")
)

CREATE TABLE "employment" (
    "Company_ID" int,
    "People_ID" int,
    "Year_working" int,
    PRIMARY KEY ("Company_ID","People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
    FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)

### Question
Show the different headquarters and number of companies at each headquarter.

### SQL
SELECT Headquarters ,  COUNT(*) FROM company GROUP BY Headquarters
### Database Schema
CREATE TABLE "people" (
    "People_ID" int,
    "Age" int,
    "Name" text,
    "Nationality" text,
    "Graduation_College" text,
    PRIMARY KEY ("People_ID")
)

CREATE TABLE "company" (
    "Company_ID" real,
    "Name" text,
    "Headquarters" text,
    "Industry" text,
    "Sales_in_Billion" real,
    "Profits_in_Billion" real,
    "Assets_in_Billion" real,
    "Market_Value_in_Billion" real,
    PRIMARY KEY ("Company_ID")
)

CREATE TABLE "employment" (
    "Company_ID" int,
    "People_ID" int,
    "Year_working" int,
    PRIMARY KEY ("Company_ID","People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
    FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)

### Question
Show the most common headquarter for companies.

### SQL
SELECT Headquarters FROM company GROUP BY Headquarters ORDER BY COUNT(*) DESC LIMIT 1
### Database Schema
CREATE TABLE "people" (
    "People_ID" int,
    "Age" int,
    "Name" text,
    "Nationality" text,
    "Graduation_College" text,
    PRIMARY KEY ("People_ID")
)

CREATE TABLE "company" (
    "Company_ID" real,
    "Name" text,
    "Headquarters" text,
    "Industry" text,
    "Sales_in_Billion" real,
    "Profits_in_Billion" real,
    "Assets_in_Billion" real,
    "Market_Value_in_Billion" real,
    PRIMARY KEY ("Company_ID")
)

CREATE TABLE "employment" (
    "Company_ID" int,
    "People_ID" int,
    "Year_working" int,
    PRIMARY KEY ("Company_ID","People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
    FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)

### Question
Show the headquarters that have at least two companies.

### SQL
SELECT Headquarters FROM company GROUP BY Headquarters HAVING COUNT(*)  >=  2
### Database Schema
CREATE TABLE "people" (
    "People_ID" int,
    "Age" int,
    "Name" text,
    "Nationality" text,
    "Graduation_College" text,
    PRIMARY KEY ("People_ID")
)

CREATE TABLE "company" (
    "Company_ID" real,
    "Name" text,
    "Headquarters" text,
    "Industry" text,
    "Sales_in_Billion" real,
    "Profits_in_Billion" real,
    "Assets_in_Billion" real,
    "Market_Value_in_Billion" real,
    PRIMARY KEY ("Company_ID")
)

CREATE TABLE "employment" (
    "Company_ID" int,
    "People_ID" int,
    "Year_working" int,
    PRIMARY KEY ("Company_ID","People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
    FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)

### Question
Show the headquarters that have both companies in banking industry and companies in oil and gas industry.

### SQL
SELECT Headquarters FROM company WHERE Industry  =  "Banking" INTERSECT SELECT Headquarters FROM company WHERE Industry  =  "Oil and gas"
### Database Schema
CREATE TABLE "people" (
    "People_ID" int,
    "Age" int,
    "Name" text,
    "Nationality" text,
    "Graduation_College" text,
    PRIMARY KEY ("People_ID")
)

CREATE TABLE "company" (
    "Company_ID" real,
    "Name" text,
    "Headquarters" text,
    "Industry" text,
    "Sales_in_Billion" real,
    "Profits_in_Billion" real,
    "Assets_in_Billion" real,
    "Market_Value_in_Billion" real,
    PRIMARY KEY ("Company_ID")
)

CREATE TABLE "employment" (
    "Company_ID" int,
    "People_ID" int,
    "Year_working" int,
    PRIMARY KEY ("Company_ID","People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
    FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)

### Question
Show the names of companies and of employees.

### SQL
SELECT T3.Name ,  T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID  =  T2.People_ID JOIN company AS T3 ON T1.Company_ID  =  T3.Company_ID
### Database Schema
CREATE TABLE "people" (
    "People_ID" int,
    "Age" int,
    "Name" text,
    "Nationality" text,
    "Graduation_College" text,
    PRIMARY KEY ("People_ID")
)

CREATE TABLE "company" (
    "Company_ID" real,
    "Name" text,
    "Headquarters" text,
    "Industry" text,
    "Sales_in_Billion" real,
    "Profits_in_Billion" real,
    "Assets_in_Billion" real,
    "Market_Value_in_Billion" real,
    PRIMARY KEY ("Company_ID")
)

CREATE TABLE "employment" (
    "Company_ID" int,
    "People_ID" int,
    "Year_working" int,
    PRIMARY KEY ("Company_ID","People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
    FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)

### Question
Show names of companies and that of employees in descending order of number of years working for that employee.

### SQL
SELECT T3.Name ,  T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID  =  T2.People_ID JOIN company AS T3 ON T1.Company_ID  =  T3.Company_ID ORDER BY T1.Year_working
### Database Schema
CREATE TABLE "people" (
    "People_ID" int,
    "Age" int,
    "Name" text,
    "Nationality" text,
    "Graduation_College" text,
    PRIMARY KEY ("People_ID")
)

CREATE TABLE "company" (
    "Company_ID" real,
    "Name" text,
    "Headquarters" text,
    "Industry" text,
    "Sales_in_Billion" real,
    "Profits_in_Billion" real,
    "Assets_in_Billion" real,
    "Market_Value_in_Billion" real,
    PRIMARY KEY ("Company_ID")
)

CREATE TABLE "employment" (
    "Company_ID" int,
    "People_ID" int,
    "Year_working" int,
    PRIMARY KEY ("Company_ID","People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
    FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)

### Question
Show the names of employees that work for companies with sales bigger than 200.

### SQL
SELECT T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID  =  T2.People_ID JOIN company AS T3 ON T1.Company_ID  =  T3.Company_ID WHERE T3.Sales_in_Billion  >  200
### Database Schema
CREATE TABLE "people" (
    "People_ID" int,
    "Age" int,
    "Name" text,
    "Nationality" text,
    "Graduation_College" text,
    PRIMARY KEY ("People_ID")
)

CREATE TABLE "company" (
    "Company_ID" real,
    "Name" text,
    "Headquarters" text,
    "Industry" text,
    "Sales_in_Billion" real,
    "Profits_in_Billion" real,
    "Assets_in_Billion" real,
    "Market_Value_in_Billion" real,
    PRIMARY KEY ("Company_ID")
)

CREATE TABLE "employment" (
    "Company_ID" int,
    "People_ID" int,
    "Year_working" int,
    PRIMARY KEY ("Company_ID","People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
    FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)

### Question
Show the names of companies and the number of employees they have

### SQL
SELECT T3.Name ,  COUNT(*) FROM employment AS T1 JOIN people AS T2 ON T1.People_ID  =  T2.People_ID JOIN company AS T3 ON T1.Company_ID  =  T3.Company_ID GROUP BY T3.Name
### Database Schema
CREATE TABLE "people" (
    "People_ID" int,
    "Age" int,
    "Name" text,
    "Nationality" text,
    "Graduation_College" text,
    PRIMARY KEY ("People_ID")
)

CREATE TABLE "company" (
    "Company_ID" real,
    "Name" text,
    "Headquarters" text,
    "Industry" text,
    "Sales_in_Billion" real,
    "Profits_in_Billion" real,
    "Assets_in_Billion" real,
    "Market_Value_in_Billion" real,
    PRIMARY KEY ("Company_ID")
)

CREATE TABLE "employment" (
    "Company_ID" int,
    "People_ID" int,
    "Year_working" int,
    PRIMARY KEY ("Company_ID","People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
    FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)

### Question
List the names of people that are not employed by any company

### SQL
SELECT Name FROM people WHERE People_ID NOT IN (SELECT People_ID FROM employment)
### Database Schema
CREATE TABLE "people" (
    "People_ID" int,
    "Age" int,
    "Name" text,
    "Nationality" text,
    "Graduation_College" text,
    PRIMARY KEY ("People_ID")
)

CREATE TABLE "company" (
    "Company_ID" real,
    "Name" text,
    "Headquarters" text,
    "Industry" text,
    "Sales_in_Billion" real,
    "Profits_in_Billion" real,
    "Assets_in_Billion" real,
    "Market_Value_in_Billion" real,
    PRIMARY KEY ("Company_ID")
)

CREATE TABLE "employment" (
    "Company_ID" int,
    "People_ID" int,
    "Year_working" int,
    PRIMARY KEY ("Company_ID","People_ID"),
    FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
    FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)

### Question
list the names of the companies with more than 200 sales in the descending order of sales and profits.

### SQL
SELECT name FROM company WHERE Sales_in_Billion  >  200 ORDER BY Sales_in_Billion ,  Profits_in_Billion DESC
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
How many film are there?

### SQL
SELECT count(*) FROM film
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
Count the number of films.

### SQL
SELECT count(*) FROM film
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
List the distinct director of all films.

### SQL
SELECT DISTINCT Director FROM film
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
What are the different film Directors?

### SQL
SELECT DISTINCT Director FROM film
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
What is the average ticket sales gross in dollars of films?

### SQL
SELECT avg(Gross_in_dollar) FROM film
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
Return the average gross sales in dollars across all films.

### SQL
SELECT avg(Gross_in_dollar) FROM film
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
What are the low and high estimates of film markets?

### SQL
SELECT Low_Estimate ,  High_Estimate FROM film_market_estimation
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
Return the low and high estimates for all film markets.

### SQL
SELECT Low_Estimate ,  High_Estimate FROM film_market_estimation
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
What are the types of film market estimations in year 1995?

### SQL
SELECT TYPE FROM film_market_estimation WHERE YEAR  =  1995
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
Return the types of film market estimations in 1995.

### SQL
SELECT TYPE FROM film_market_estimation WHERE YEAR  =  1995
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
What are the maximum and minimum number of cities in all markets.

### SQL
SELECT max(Number_cities) ,  min(Number_cities) FROM market
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
Return the maximum and minimum number of cities across all markets.

### SQL
SELECT max(Number_cities) ,  min(Number_cities) FROM market
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
How many markets have number of cities smaller than 300?

### SQL
SELECT count(*) FROM market WHERE Number_cities  <  300
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
Count the number of markets that have a number of cities lower than 300.

### SQL
SELECT count(*) FROM market WHERE Number_cities  <  300
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
List all countries of markets in ascending alphabetical order.

### SQL
SELECT Country FROM market ORDER BY Country ASC
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
What are the countries for each market, ordered alphabetically?

### SQL
SELECT Country FROM market ORDER BY Country ASC
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
List all countries of markets in descending order of number of cities.

### SQL
SELECT Country FROM market ORDER BY Number_cities DESC
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
What are the countries for each market ordered by decreasing number of cities?

### SQL
SELECT Country FROM market ORDER BY Number_cities DESC
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
Please show the titles of films and the types of market estimations.

### SQL
SELECT T1.Title ,  T2.Type FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID  =  T2.Film_ID
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
What are the titles of films and corresponding types of market estimations?

### SQL
SELECT T1.Title ,  T2.Type FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID  =  T2.Film_ID
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
Show the distinct director of films with market estimation in the year of 1995.

### SQL
SELECT DISTINCT T1.Director FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID  =  T2.Film_ID WHERE T2.Year  =  1995
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
Who are the different directors of films which had market estimation in 1995?

### SQL
SELECT DISTINCT T1.Director FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID  =  T2.Film_ID WHERE T2.Year  =  1995
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
What is the average number of cities of markets with low film market estimate bigger than 10000?

### SQL
SELECT avg(T2.Number_cities) FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID  =  T2.Market_ID WHERE T1.Low_Estimate  >  10000
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
Give the average number of cities within markets that had a low market estimation larger than 10000?

### SQL
SELECT avg(T2.Number_cities) FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID  =  T2.Market_ID WHERE T1.Low_Estimate  >  10000
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
Please list the countries and years of film market estimations.

### SQL
SELECT T2.Country ,  T1.Year FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID  =  T2.Market_ID
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
What are the countries of markets and their corresponding years of market estimation?

### SQL
SELECT T2.Country ,  T1.Year FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID  =  T2.Market_ID
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
Please list the years of film market estimations when the market is in country "Japan" in descending order.

### SQL
SELECT T1.Year FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID  =  T2.Market_ID WHERE T2.Country  =  "Japan" ORDER BY T1.Year DESC
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
What are the years of film market estimation for the market of Japan, ordered by year descending?

### SQL
SELECT T1.Year FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID  =  T2.Market_ID WHERE T2.Country  =  "Japan" ORDER BY T1.Year DESC
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
List the studios of each film and the number of films produced by that studio.

### SQL
SELECT Studio ,  COUNT(*) FROM film GROUP BY Studio
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
How films are produced by each studio?

### SQL
SELECT Studio ,  COUNT(*) FROM film GROUP BY Studio
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
List the name of film studio that have the most number of films.

### SQL
SELECT Studio FROM film GROUP BY Studio ORDER BY COUNT(*) DESC LIMIT 1
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
What is the name of teh studio that created the most films?

### SQL
SELECT Studio FROM film GROUP BY Studio ORDER BY COUNT(*) DESC LIMIT 1
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
List the names of studios that have at least two films.

### SQL
SELECT Studio FROM film GROUP BY Studio HAVING COUNT(*)  >=  2
### Database Schema
CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)

CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)

CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)

### Question
What are the names of studios that have made two or more films?

### SQL
SELECT Studio FROM film GROUP BY Studio HAVING COUNT(*)  >=  2