db_id stringclasses 66 values | question stringlengths 24 325 | evidence stringlengths 1 673 ⌀ | gold_query stringlengths 23 804 | db_schema stringclasses 66 values |
|---|---|---|---|---|
movies_4 | Among Warner Bros. Pictures' movies, which title made the highest revenue? | Warner Bros. Pictures' movies refers to company_name = 'Warner Bros. Pictures'; highest revenue refers to max(revenue) | SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Warner Bros. Pictures' ORDER BY T3.revenue DESC LIMIT 1 | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
olympics | Which region is the majority of the athletes from? | region refers to region_name; the majority of the athletes from refer to MAX(COUNT(region_name)); | SELECT T2.region_name FROM person_region AS T1 INNER JOIN noc_region AS T2 ON T1.region_id = T2.id GROUP BY T2.region_name ORDER BY COUNT(T1.person_id) DESC LIMIT 1 | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
movies_4 | How many movies have "vi" as their language code? | "vi" as their language code refers to language_code = 'vi' | SELECT COUNT(T1.movie_id) FROM movie_languages AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_code = 'vi' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
movies_4 | List down the IDs of the production companies that released the movies in 1916. | IDs of the production companies refers to company_id; movies in 1916 refers to release_date LIKE '1916%' | SELECT T2.company_id FROM movie AS T1 INNER JOIN movie_company AS T2 ON T1.movie_id = T2.movie_id WHERE CAST(STRFTIME('%Y', T1.release_date) AS INT) = 1916 | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | Among all the residential areas in Delaware, how many of them implement daylight saving? | "Delaware" is a county; implement daylight savings refers to daylight_saving = 'Yes' | SELECT COUNT(T1.zip_code) FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'DELAWARE' AND T1.daylight_savings = 'Yes' | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | Provide the average revenue of all the French movies. | French movies refers to country_name = 'France'; average revenue = AVG(revenue) | SELECT AVG(T1.revenue) FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE T3.COUNTry_name = 'France' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
olympics | Among the males, list the region name of people with height greater than 87% of the average height of all people listed. | males refer to gender = 'M'; height greater than 87% of the average height refers to height > MULTIPLY(AVG(height), 0.87); | SELECT DISTINCT T1.region_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.gender = 'M' AND T3.height * 100 > ( SELECT AVG(height) FROM person WHERE gender = 'M' ) * 87 | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
movies_4 | What is the ID of the production company which produced the movie "Gladiator"? | ID of the production company refers to company_id; movie "Gladiator" refers to title = 'Gladiator' | SELECT T2.company_id FROM movie AS T1 INNER JOIN movie_company AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'Gladiator' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | In which county is the residential area with the highest average income per household located? | highest average income per household refers to Max(avg_income_per_household) | SELECT T2.county FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO' GROUP BY T2.county ORDER BY T1.avg_income_per_household DESC LIMIT 1 | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | What is the original language of the movie with the tagline "An offer you can't refuse."? | language refers to language_name; original language refers to language_role = 'Original' | SELECT T3.language_name FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_id INNER JOIN language_role AS T4 ON T2.language_role_id = T4.role_id WHERE T4.language_role = 'Original' AND T1.tagline LIKE 'An offer you can%t refuse.' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
movies_4 | List down the movies produced by Lucasfilm. | movies refers to title; produced by Lucasfil refers to company_name = 'Lucasfilm' | SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Lucasfilm' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
movies_4 | What are the top 5 most popular movie directors? | directors refers to job = 'Director'; most popular refers to max(popularity) | SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T2.job = 'Director' ORDER BY T1.popularity DESC LIMIT 5 | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | Please list the numbers of males in all the residential areas in Arecibo county. | "ARECIBO" is the county; number of males refers to Sum(male_population) | SELECT SUM(T1.male_population) FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO' | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
address | Among all the residential areas in Arecibo county, what is the zip_code of the one with the highest white population? | "ARECIBO" is the county; highest white population refers to Max(white_population) | SELECT T1.zip_code FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO' ORDER BY T1.white_population DESC LIMIT 1 | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | List all the unspecified gender characters. | characters refers to character_name; gender = 'Unspecified' | SELECT T1.character_name FROM movie_cast AS T1 INNER JOIN gender AS T2 ON T1.gender_id = T2.gender_id WHERE T2.gender = 'Unspecified' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | Please list the zip_codes of all the residential areas in Huntingdon county with over 30 employees. | over 30 employees refers to employee > 30; 'HUNTINGDON' is the county | SELECT DISTINCT T1.zip_code FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'HUNTINGDON' AND T1.employees > 30 | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | What is the title of the movie with the most keywords? | most keywords refers to max(count(keyword_id)) | SELECT T1.title FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id GROUP BY T1.title ORDER BY COUNT(T2.keyword_id) DESC LIMIT 1 | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
olympics | What is the name of the oldest competitor? | name refers to full_name; the oldest refers to MAX(age); | SELECT T1.full_name FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id ORDER BY T2.age DESC LIMIT 1 | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
address | What is the bad alias of the residential area with the highest average house value? | highest average house value refers to Max(avg_house_value) | SELECT T2.bad_alias FROM zip_data AS T1 INNER JOIN avoid AS T2 ON T1.zip_code = T2.zip_code WHERE T1.avg_house_value = ( SELECT MAX(avg_house_value) FROM zip_data ) LIMIT 1 | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | What is the average ratio between female and male actors in a movie? | female refers to gender = 'Female';male refers to gender = 'Male'; average ratio = divide(divide(sum(gender_id) when gender = 'Female', sum(gender_id) when gender = 'Male'), count(movie_id)) as percentage | SELECT CAST(COUNT(CASE WHEN T2.gender = 'Female' THEN T1.person_id ELSE NULL END) AS REAL) / COUNT(CASE WHEN T2.gender = 'Male' THEN T1.person_id ELSE NULL END) FROM movie_cast AS T1 INNER JOIN gender AS T2 ON T1.gender_id = T2.gender_id | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | Please list the names of all the counties with at least one residential area that implements daylight saving. | implements daylight savings refers to daylight_savings = 'Yes' | SELECT DISTINCT T2.county FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T1.daylight_savings = 'Yes' | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | List the film with the highest budget in each genre. | highest budget refers to max(budget); each genre refers to genre_name; film also means movie; list the film refers to title of movie | SELECT T3.genre_name, MAX(T1.budget) FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id GROUP BY T3.genre_name | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
movies_4 | What percentage of films are made in the US? | films' and 'movies' are synonyms; made in the US refers to country_iso_code = 'US'; percentage = divide(sum(country_id) when country_iso_code = 'US', count(country_id)) * 100 as percentage | SELECT CAST(COUNT(CASE WHEN T3.COUNTry_iso_code = 'US' THEN T1.movie_id ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | Among the residential areas with the bad alias "Internal Revenue Service", how many of them are in the Eastern time zone? | "Internal Revenue Service" is the bad_alias; in Eastern time zone refers to time_zone = 'Eastern' | SELECT COUNT(T1.zip_code) FROM zip_data AS T1 INNER JOIN avoid AS T2 ON T1.zip_code = T2.zip_code WHERE T2.bad_alias = 'Internal Revenue Service' AND T1.time_zone = 'Eastern' | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | Calculate the 2016 gap between the average revenue for Indian and American films. | 2016 refers to release_date LIKE '2016%'; Indian and American films refers to country_name = 'India' and country_name = 'United States of America'; gap between the average revenue refers to subtract(divide(sum(revenue), count(movie_id)) when country_name = 'United States of America', divide(sum(revenue), count(movie_id)) when country_name = 'India') | SELECT AVG(CASE WHEN T3.COUNTry_name = 'United States of America' THEN T1.revenue END) - AVG(CASE WHEN T3.COUNTry_name = 'India' THEN T1.revenue END) AS CALCULATE FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE CAST(STRFTIME('%Y', T1.release_date) AS INT) = 2016 | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
olympics | Who is the heaviest athlete? | Who refers to full_name; the heaviest refers to MAX(weight); | SELECT full_name FROM person ORDER BY weight DESC LIMIT 1 | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
movies_4 | Provide the ID and ISO code of Belgium. | ID refers to country_id; ISO code refers to country_iso_code; Belgium refers to country_name = 'Belgium' | SELECT COUNTry_id, COUNTry_iso_code FROM COUNTry WHERE COUNTry_name = 'Belgium' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | What is the highest gender ratio of the residential areas in Arecibo county? | "ARECIBO" is the county; highest gender ration refers to Max(Divide (male_population, female_population)) | SELECT CAST(T1.male_population AS REAL) / T1.female_population FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO' AND T1.female_population <> 0 ORDER BY 1 DESC LIMIT 1 | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | Which department has the most people? | department refers to department_name; most people refers to max(count(department_id)) | SELECT T1.department_name FROM department AS T1 INNER JOIN movie_crew AS T2 ON T1.department_id = T2.department_id GROUP BY T1.department_id ORDER BY COUNT(T2.department_id) DESC LIMIT 1 | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | Please list the Asian populations of all the residential areas with the bad alias "URB San Joaquin". | "URB San Joaquin" is the bad_alias | SELECT SUM(T1.asian_population) FROM zip_data AS T1 INNER JOIN avoid AS T2 ON T1.zip_code = T2.zip_code WHERE T2.bad_alias = 'URB San Joaquin' | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | Provide the release date and language of the most popular movie. | language refers to langauge_name; most popular movie refers to max(popularity) | SELECT T1.release_date, T3.language_name FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_id ORDER BY T1.popularity DESC LIMIT 1 | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | What is the alias of the city called Hartford? | "Hartford" is the city | SELECT DISTINCT T2.alias FROM zip_data AS T1 INNER JOIN alias AS T2 ON T1.zip_code = T2.zip_code WHERE T1.city = 'Hartford' | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | List the movies released in 1945. | List the movies refers to title; released in 1945 refers to release_date LIKE '1945%' | SELECT title FROM movie WHERE CAST(STRFTIME('%Y', release_date) AS INT) = 1945 | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | Please list the bad alias of all the residential areas with a median female age of over 32. | median female age of over 32 refers to median_female_age > 32 | SELECT DISTINCT T2.bad_alias FROM zip_data AS T1 INNER JOIN avoid AS T2 ON T1.zip_code = T2.zip_code WHERE T1.female_median_age > 32 | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | List the movies in the Somali language. | List the movies refers to title; Somali language refers to language_name = 'Somali' | SELECT T1.title FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_id WHERE T3.language_name = 'Somali' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | What is the area code of the city with the female median age over 32 years old? | null | SELECT T1.area_code FROM area_code AS T1 INNER JOIN ZIP_Data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.female_median_age > 32 GROUP BY T1.area_code | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | List all companies who worked in the movie 'Ultramarines: A Warhammer 40,000 Movie.' | all companies refers to company_name; movie 'Ultramarines: A Warhammer 40,000 Movie' refers to title = 'Ultramarines: A Warhammer 40,000 Movie' | SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T3.title = 'Ultramarines: A Warhammer 40,000 Movie' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | What are the precise locations of the cities with an area code of 787? | precise location refers to latitude, longitude | SELECT T2.latitude, T2.longitude FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = '787' GROUP BY T2.latitude, T2.longitude | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | List the character names in the "Open Water" movie. | "Open Water" movie refers to title = 'Open Water' | SELECT T2.character_name FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'Open Water' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
movies_4 | List the character names played by Catherine Deneuve. | null | SELECT T2.character_name FROM person AS T1 INNER JOIN movie_cast AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Catherine Deneuve' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | What is the average median female age of all the residential areas in the Arecibo county? | "ARECIBO" is the county; average median female age = Divide (Sum(median_female_age), Count(country)) | SELECT SUM(T1.female_median_age) / COUNT(T1.zip_code) FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO' | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | List the names of camera supervisors in the crew. | names refers to person_name; camera supervisors refers to job = 'Camera Supervisor'; | SELECT T1.person_name FROM person AS T1 INNER JOIN movie_crew AS T2 ON T1.person_id = T2.person_id WHERE T2.job = 'Camera Supervisor' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | How many post offices are there in New York? | "New York" refers to state = 'NY' and name = 'New York'; 'Post Office' is the type | SELECT COUNT(DISTINCT T2.zip_code) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.abbreviation = 'NY' AND T2.type = 'Post Office' | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | What is the original language of the "Four Rooms" movie? | language refers to language_name; original language refers to language_role = 'Original'; "Four Rooms" refers to title = 'Four Rooms' | SELECT T3.language_name FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_id INNER JOIN language_role AS T4 ON T2.language_role_id = T4.role_id WHERE T4.language_role = 'Original' AND T1.title = 'Four Rooms' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
movies_4 | Provide the titles and revenues of the movies produced by the DreamWorks company. | produced by the DreamWorks company refers to company_name = 'DreamWorks' | SELECT T1.title, T1.revenue FROM movie AS T1 INNER JOIN movie_company AS T2 ON T1.movie_id = T2.movie_id INNER JOIN production_company AS T3 ON T2.company_id = T3.company_id WHERE T3.company_name = 'DreamWorks' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
movies_4 | Who is the main actor in the "Pirates of the Caribbean: At World's End" movie? | main actor refers to person_name where Min(cast_order); "Pirates of the Caribbean: At World's End" refers to title = 'Pirates of the Caribbean: At World''s End' | SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' ORDER BY T2.cast_order LIMIT 1 | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | In which county can you find the city with the highest number of females? | highest number of females refers to Max(female_population) | SELECT T4.county FROM zip_data AS T3 INNER JOIN country AS T4 ON T3.zip_code = T4.zip_code GROUP BY T4.county ORDER BY T3.female_population DESC LIMIT 1 | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | Provide the names and departments of the person who worked as a music editor in the "Pirates of the Caribbean: At World's End" movie. | names refers to person_name; departments refers to department_name; worked as a music editor refers to job = 'Music Editor'; "Pirates of the Caribbean: At World's End" refers to title = 'Pirates of the Caribbean: At World''s End' | SELECT T3.person_name, T4.department_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id INNER JOIN department AS T4 ON T2.department_id = T4.department_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' AND T2.job = 'Music Editor' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | How many counties are there in Alabama? | "Alabama" is the name | SELECT COUNT(T2.county) FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Alabama' | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | What is the gender of the character 'USAF Master Sgt. Epps?' | character 'USAF Master Sgt. Epps' refers to character_name = 'USAF Master Sgt. Epps' | SELECT T2.gender FROM movie_cast AS T1 INNER JOIN gender AS T2 ON T1.gender_id = T2.gender_id WHERE T1.character_name = 'USAF Master Sgt. Epps' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | List all the zip codes in the county of New Castle in Delaware. | "NEW CASTLE" is the county; 'Delaware' is the name of state | SELECT DISTINCT T2.zip_code FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T2.county = 'NEW CASTLE' AND T1.name = 'Delaware' | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | List the genres of Forrest Gump movie. | genres refers to genre_name; Forrest Gump movie refers to title = 'Forrest Gump' | SELECT T3.genre_name FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T1.title = 'Forrest Gump' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
movies_4 | List the job titles of Sally Menke in the crew. | job titles refers to job | SELECT DISTINCT T2.job FROM person AS T1 INNER JOIN movie_crew AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Sally Menke' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | In California, how many delivery receptacles are there in the community post office that has the highest number of delivery receptacles? | in California refers to name = 'California' and state = 'CA'; 'Community Post Office' is the Type | SELECT COUNT(*) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.abbreviation = 'CA' AND T2.type LIKE '%Community Post Office%' AND T1.name = 'California' AND T2.state = 'CA' | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | What keyword can the user use to search for the movie Finding Nemo? | What keyword refers to keyword_name; Finding Nemo refers to title = 'Finding Nemo' | SELECT T3.keyword_name FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T1.title = 'Finding Nemo' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
movies_4 | How many main actors are there in the movie Pirates of the Caribbean: At World's End? | main actors refers to gender = 'male' and min(cast_order); Pirates of the Caribbean: At World's End refers to title = 'Pirates of the Caribbean: At World''s End' | SELECT COUNT(T2.cast_order) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T3.gender_id = T2.gender_id WHERE T3.gender = 'Male' OR T3.gender = 'Female' AND T1.title = 'Pirates of the Caribbean: At World''s End' AND T2.cast_order = ( SELECT MIN(T2.cast_order) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T3.gender_id = T2.gender_id WHERE T3.gender = 'Male' OR T3.gender = 'Female' AND T1.title = 'Pirates of the Caribbean: At World''s End' ) | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | What is the difference in the most populated city of Allentown-Bethlehem-Easton, PA-NJ in 2020 against its population in 2010? | "Allentown-Bethlehem-Easton, PA-NJ" is the CBSA_name; most populated city refers to Max(population_2020); difference = Subtract (population_2020, population_2011) | SELECT T1.population_2020 - T1.population_2010 AS result_data FROM zip_data AS T1 INNER JOIN CBSA AS T2 ON T1.CBSA = T2.CBSA WHERE T2.CBSA_name = 'Allentown-Bethlehem-Easton, PA-NJ' ORDER BY T1.population_2020 DESC LIMIT 1 | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | How many movies were produced in Canada? | produced in Canada refers to country_name = 'Canada' | SELECT COUNT(T2.movie_id) FROM COUNTry AS T1 INNER JOIN production_COUNTry AS T2 ON T1.COUNTry_id = T2.COUNTry_id WHERE T1.COUNTry_name = 'Canada' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
movies_4 | Which character did Orlando Bloom play in the movie Pirates of the Caribbean: The Curse of the Black Pearl? | Which character refers to character_name; movie Pirates of the Caribbean: The Curse of the Black Pearl refers to title = 'Pirates of the Caribbean: The Curse of the Black Pearl' | SELECT T2.character_name FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title = 'Pirates of the Caribbean: The Curse of the Black Pearl' AND T3.person_name = 'Orlando Bloom' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
olympics | Which city were the Olympic games held in 1992? | city refers to city_name; in 1992 refers to games_year = 1992; | SELECT T2.city_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T3.games_year = 1992 | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
movies_4 | Which genre does the movie Dancer in the Dark belong to? | genre refers to genre_name; movie Dancer in the Dark refers to title = 'Dancer in the Dark' | SELECT T3.genre_name FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T1.title = 'Dancer in the Dark' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | In the state where Lisa Murkowski is the representative, how many cities have zero employees? | zero employee refers to employees = 0 | SELECT COUNT(T3.city) FROM congress AS T1 INNER JOIN state AS T2 ON T1.abbreviation = T2.abbreviation INNER JOIN zip_data AS T3 ON T2.abbreviation = T3.state WHERE T1.first_name = 'Murkowski' AND T1.last_name = 'Lisa' AND T3.employees = 0 | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | Find the difference in percentage of the movies under keywords of "woman director" and "independent film". | under keywords of "woman director" and "independent film" refers to keyword_name = 'woman director' and keyword_name = 'independent film'; difference in percentage = divide(subtract(count(movie_id) when keyword_name = 'woman director', count(movie_id) when keyword_name = 'independent film'), count(movie_id)) as percentage | SELECT CAST((SUM(CASE WHEN T1.keyword_name = 'woman director' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.keyword_name = 'independent film' THEN 1 ELSE 0 END)) AS REAL) * 100 / SUM(CASE WHEN T1.keyword_name = 'independent film' THEN 1 ELSE 0 END) FROM keyword AS T1 INNER JOIN movie_keywords AS T2 ON T1.keyword_id = T2.keyword_id | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | What are the names of the states whose postal point is not affiliated with any organization? | postal point is not affiliated with any organization refers to division is null | SELECT DISTINCT T2.name FROM zip_data AS T1 INNER JOIN state AS T2 ON T1.state = T2.abbreviation WHERE T1.division IS NULL | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | Which movies did the company Paramount Pictures produce in 2000? | Which movies refers to title; company Paramount Pictures refers to company_name = 'Paramount Pictures'; in 2000 refers to release_date LIKE '2000%' | SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Paramount Pictures' AND CAST(STRFTIME('%Y', T3.release_date) AS INT) = 2000 | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
movies_4 | Which movie did the company 'Radiant Film GmbH' work on? | Which movie refers to title; company 'Radiant Film GmbH' refers to company_name = 'Radiant Film GmbH' | SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Radiant Film GmbH' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | What party does the area with the zip code 91701 belong to? | null | SELECT T1.party FROM congress AS T1 INNER JOIN state AS T2 ON T1.abbreviation = T2.abbreviation INNER JOIN zip_data AS T3 ON T2.abbreviation = T3.state WHERE T3.zip_code = 91701 GROUP BY T1.party | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | Which movies have the participation of actor Harrison Ford? | Which movies refers to title; actor refers to person_name | SELECT T1.title FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Harrison Ford' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
movies_4 | What is the title of the highest-budget film to date? Please include the revenue and name the country. | highest-budget film refers to max(budget); name the country refers to country_name | SELECT T1.title, T1.revenue, T3.COUNTry_name FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id ORDER BY T1.budget DESC LIMIT 1 | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | How many representatives are there in the state with the highest monthly benefit payments for retired workers? | state with highest monthly benefits payment for retired workers refers to Max(monthly_benefits_retired_workers) | SELECT COUNT(T3.cognress_rep_id) FROM zip_data AS T1 INNER JOIN state AS T2 ON T1.state = T2.abbreviation INNER JOIN congress AS T3 ON T2.abbreviation = T3.abbreviation ORDER BY T1.monthly_benefits_retired_workers DESC LIMIT 1 | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | What is the average number of crews for a movie? | average number of crews = divide(count(person_id), COUNT(movie_id)) | SELECT CAST(SUM(CD) AS REAL) / COUNT(movie_id) FROM ( SELECT movie_id, COUNT(person_id) AS CD FROM movie_crew GROUP BY movie_id ) | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | Which state is Outagamie County in? Give the full name of the state. | "OUTAGAMIE" is the county | SELECT DISTINCT T2.name FROM country AS T1 INNER JOIN state AS T2 ON T1.state = T2.abbreviation WHERE T1.county = 'OUTAGAMIE' | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | What is the average revenue made by Latin movies? | Latin movies refers to language_name = 'Latin'; average revenue = AVG(revenue) | SELECT AVG(T1.revenue) FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_id WHERE T3.language_name = 'Latin' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
movies_4 | What is the average number of horror movies among all movies genre? | horror movies refers to genre_name = 'horror'; average number = divide(sum(movie_id) when genre_name = 'horror', count(movie_id)) | SELECT CAST(COUNT(CASE WHEN T3.genre_name = 'Horror' THEN T1.movie_id ELSE NULL END) AS REAL) / COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
movies_4 | What are the genres of Sky Captain and the World of Tomorrow? | genres refers to genre_name; Sky Captain and the World of Tomorrow refers to title = 'Sky Captain and the World of Tomorrow' | SELECT T3.genre_name FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T1.title = 'Sky Captain and the World of Tomorrow' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
olympics | What is the name of medal that competitor id 9 obtained? | name of medal refers to medal_name; | SELECT DISTINCT T1.medal_name FROM medal AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.medal_id WHERE T2.competitor_id = 9 | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
movies_4 | List the names of all the producers in the movie "Pirates of the Caribbean: At World's End". | List the names refers to person_name; producers refers to job = 'Producer'; "Pirates of the Caribbean: At World's End" refers to title = 'Pirates of the Caribbean: The Curse of the Black Pearl' | SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title = 'Pirates of the Caribbean: The Curse of the Black Pearl' AND T2.job = 'Producer' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | Show the alias for the county at coordinate (18.090875, -66.867756). | coordinates refers to latitude, longitude; latitude = '18.090875; longitude = '-66.867756' | SELECT T2.alias FROM zip_data AS T1 INNER JOIN alias AS T2 ON T1.zip_code = T2.zip_code WHERE T1.latitude = 18.090875 AND T1.longitude = -66.867756 | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
codebase_comments | How many English language codes whose comments for the method are in the XML format? | English language refers to Lang = 'en'; the comments for this method is XML format refers to CommentIsXml = 1; | SELECT COUNT(Lang) FROM Method WHERE Lang = 'en' AND CommentIsXml = 1 | CREATE TABLE Method
(
ApiCalls TEXT, --
NameTokenized TEXT, --
Name TEXT, --
SolutionId INTEGER, --
CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
SampledAt INTEGER, --
Id INTEGER not null primary key autoincrement,
Lang TEXT, --
FullComment TEXT, --
Summary TEXT, --
);
CREATE TABLE Repo
(
Stars INTEGER, --
Forks INTEGER, --
Watchers INTEGER, --
Id INTEGER not null primary key autoincrement,
ProcessedTime INTEGER, --
Url TEXT, --
);
CREATE TABLE Solution
(
WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
Id INTEGER not null primary key autoincrement,
RepoId INTEGER, --
ProcessedTime INTEGER, --
Path TEXT, --
);
CREATE TABLE MethodParameter
(
Name TEXT, --
MethodId TEXT, --
Id INTEGER not null primary key autoincrement,
Type TEXT, --
); |
movies_4 | Provide the production companies of the movie that has over 35% average running time per movie in 2016. | production companies refers to company_name; in 2016 refers to release_date LIKE '2016%'; over 35% average running time per movie refers to divide(subtract(runtime, AVG(runtime)), AVG(runtime)) * 100 as percentage > 35 | SELECT T.company_name FROM ( SELECT DISTINCT T3.company_name, T1.runtime FROM movie AS T1 INNER JOIN movie_company AS T2 ON T1.movie_id = T2.movie_id INNER JOIN production_company AS T3 ON T3.company_id = T2.company_id WHERE T1.release_date LIKE '2016%' ) T WHERE T.runtime * 100 > (0.35 * ( SELECT AVG(T1.runtime) FROM movie AS T1 INNER JOIN movie_company AS T2 ON T1.movie_id = T2.movie_id INNER JOIN production_company AS T3 ON T3.company_id = T2.company_id WHERE T1.release_date LIKE '2016%' ) + ( SELECT AVG(T1.runtime) FROM movie AS T1 INNER JOIN movie_company AS T2 ON T1.movie_id = T2.movie_id INNER JOIN production_company AS T3 ON T3.company_id = T2.company_id WHERE T1.release_date LIKE '2016%' )) * 100 | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | What are the top 3 states with the highest Asian population? List the full names of all the representatives in the said states. | city with highest asian population refers to Max(Sum(asian_population)); full name refers to first_name, last_name | SELECT t.state, T1.first_name, T1.last_name FROM zip_data AS T INNER JOIN congress AS T1 ON t.state = T1.abbreviation GROUP BY t.state ORDER BY SUM(t.asian_population) DESC LIMIT 3 | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
codebase_comments | What is the time of sampling of the solution with the highest sampling time? Indicate the id number of the solution. | highest sampling time refers to max(SampledAt); id number of the solution refers to SolutionId; | SELECT DISTINCT SampledAt, SolutionId FROM Method WHERE SampledAt = ( SELECT MAX(SampledAt) FROM Method ) | CREATE TABLE Method
(
ApiCalls TEXT, --
NameTokenized TEXT, --
Name TEXT, --
SolutionId INTEGER, --
CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
SampledAt INTEGER, --
Id INTEGER not null primary key autoincrement,
Lang TEXT, --
FullComment TEXT, --
Summary TEXT, --
);
CREATE TABLE Repo
(
Stars INTEGER, --
Forks INTEGER, --
Watchers INTEGER, --
Id INTEGER not null primary key autoincrement,
ProcessedTime INTEGER, --
Url TEXT, --
);
CREATE TABLE Solution
(
WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
Id INTEGER not null primary key autoincrement,
RepoId INTEGER, --
ProcessedTime INTEGER, --
Path TEXT, --
);
CREATE TABLE MethodParameter
(
Name TEXT, --
MethodId TEXT, --
Id INTEGER not null primary key autoincrement,
Type TEXT, --
); |
address | Give the location coordinates of the city with area code 636. | location coordinate refers to (latitude, longitude) | SELECT T2.latitude, T2.longitude FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 636 | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
movies_4 | Calculate the average income made by movies using the keyword "paris". List the title of the movies. | income refers to revenue; keyword "paris" refers to keyword_name = 'paris'; average income = AVG(revenue) | SELECT AVG(T1.revenue), T1.title FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T3.keyword_name = 'paris' | CREATE TABLE production_company
(
company_name TEXT default NULL, --
company_id INTEGER not null primary key,
);
CREATE TABLE gender
(
gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
gender_id INTEGER not null primary key,
);
CREATE TABLE movie_genres
(
foreign key (movie_id) references movie(movie_id),
movie_id INTEGER default NULL, --
genre_id INTEGER default NULL, --
foreign key (genre_id) references genre(genre_id),
);
CREATE TABLE movie
(
budget INTEGER default NULL, --
popularity REAL default NULL, --
movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0
runtime INTEGER default NULL, --
tagline TEXT default NULL, --
revenue INTEGER default NULL, --
overview TEXT default NULL, --
vote_count INTEGER default NULL, --
vote_average REAL default NULL, --
release_date DATE default NULL, --
homepage TEXT default NULL, --
title TEXT default NULL, --
movie_id INTEGER not null primary key,
);
CREATE TABLE movie_languages
(
foreign key (language_role_id) references language_role(role_id),
foreign key (language_role_id) references language_role(role_id),
language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0
movie_id INTEGER default NULL, --
foreign key (language_id) references language(language_id),
foreign key (movie_id) references movie(movie_id),
language_id INTEGER default NULL, --
);
CREATE TABLE movie_crew
(
job TEXT default NULL, --
person_id INTEGER default NULL, --
department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0
foreign key (person_id) references person(person_id),
movie_id INTEGER default NULL, --
foreign key (department_id) references department(department_id),
foreign key (movie_id) references movie(movie_id),
);
CREATE TABLE keyword
(
keyword_id INTEGER not null primary key,
keyword_name TEXT default NULL, --
);
CREATE TABLE person
(
person_id INTEGER not null primary key,
person_name TEXT default NULL, --
);
CREATE TABLE movie_keywords
(
movie_id INTEGER default NULL references movie, --
keyword_id INTEGER default NULL references keyword, --
);
CREATE TABLE language
(
language_name TEXT default NULL, --
language_id INTEGER not null primary key,
language_code TEXT default NULL, --
);
CREATE TABLE genre
(
genre_id INTEGER not null primary key,
genre_name TEXT default NULL, --
);
CREATE TABLE department
(
department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
department_id INTEGER not null primary key,
);
CREATE TABLE movie_cast
(
foreign key (gender_id) references gender(gender_id),
cast_order INTEGER default NULL, --
gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0
movie_id INTEGER default NULL, --
character_name TEXT default NULL, --
foreign key (movie_id) references movie(movie_id),
person_id INTEGER default NULL, --
foreign key (person_id) references person(person_id),
);
CREATE TABLE country
(
country_id INTEGER not null primary key,
country_iso_code TEXT default NULL, --
country_name TEXT default NULL, --
);
CREATE TABLE movie_company
(
movie_id INTEGER default NULL references movie, --
company_id INTEGER default NULL references production_company, --
);
CREATE TABLE production_country
(
movie_id INTEGER default NULL, --
country_id INTEGER default NULL, --
foreign key (movie_id) references movie(movie_id),
foreign key (country_id) references country(country_id),
);
CREATE TABLE language_role
(
role_id INTEGER not null primary key,
language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0
); |
address | How many males are there in New Haven County's residential areas? | "NEW HAVEN" is the county; male refers to male_population | SELECT SUM(T1.male_population) FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'NEW HAVEN' | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
codebase_comments | What is the id of the repository with the highest number of solution path? | highest number of solution path refers to max(count(Path)); id of the repository refers to RepoId | SELECT RepoId FROM solution GROUP BY RepoId ORDER BY COUNT(Path) DESC LIMIT 1 | CREATE TABLE Method
(
ApiCalls TEXT, --
NameTokenized TEXT, --
Name TEXT, --
SolutionId INTEGER, --
CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
SampledAt INTEGER, --
Id INTEGER not null primary key autoincrement,
Lang TEXT, --
FullComment TEXT, --
Summary TEXT, --
);
CREATE TABLE Repo
(
Stars INTEGER, --
Forks INTEGER, --
Watchers INTEGER, --
Id INTEGER not null primary key autoincrement,
ProcessedTime INTEGER, --
Url TEXT, --
);
CREATE TABLE Solution
(
WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
Id INTEGER not null primary key autoincrement,
RepoId INTEGER, --
ProcessedTime INTEGER, --
Path TEXT, --
);
CREATE TABLE MethodParameter
(
Name TEXT, --
MethodId TEXT, --
Id INTEGER not null primary key autoincrement,
Type TEXT, --
); |
codebase_comments | What is the task of the method whose tokenized name is "online median filter test median window filling"? | tokenized name refers to NameTokenized; task of the method refers to the second part of name deliminated by "."; for example, the task of 'LinqToDelicious.HttpWebRequestFactory.Create' is 'HttpWebRequestFactory' | SELECT SUBSTR(SUBSTR(Name, INSTR(Name, '.') + 1), 1, INSTR(SUBSTR(Name, INSTR(Name, '.') + 1), '.') - 1) task FROM Method WHERE NameTokenized = 'online median filter test median window filling' | CREATE TABLE Method
(
ApiCalls TEXT, --
NameTokenized TEXT, --
Name TEXT, --
SolutionId INTEGER, --
CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
SampledAt INTEGER, --
Id INTEGER not null primary key autoincrement,
Lang TEXT, --
FullComment TEXT, --
Summary TEXT, --
);
CREATE TABLE Repo
(
Stars INTEGER, --
Forks INTEGER, --
Watchers INTEGER, --
Id INTEGER not null primary key autoincrement,
ProcessedTime INTEGER, --
Url TEXT, --
);
CREATE TABLE Solution
(
WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
Id INTEGER not null primary key autoincrement,
RepoId INTEGER, --
ProcessedTime INTEGER, --
Path TEXT, --
);
CREATE TABLE MethodParameter
(
Name TEXT, --
MethodId TEXT, --
Id INTEGER not null primary key autoincrement,
Type TEXT, --
); |
address | For the county represented by Thompson Bennie G, how many bad aliases does it have? | null | SELECT COUNT(DISTINCT T2.bad_alias) FROM zip_congress AS T1 INNER JOIN avoid AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T1.district = T3.cognress_rep_id WHERE T3.first_name = 'Thompson' AND T3.last_name = 'Bennie G' | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
codebase_comments | What is the name of the solution path with the highest processed time? | highest processed time refers to max(ProcessedTime); | SELECT Path FROM Solution WHERE ProcessedTime = ( SELECT MAX(ProcessedTime) FROM Solution ) | CREATE TABLE Method
(
ApiCalls TEXT, --
NameTokenized TEXT, --
Name TEXT, --
SolutionId INTEGER, --
CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
SampledAt INTEGER, --
Id INTEGER not null primary key autoincrement,
Lang TEXT, --
FullComment TEXT, --
Summary TEXT, --
);
CREATE TABLE Repo
(
Stars INTEGER, --
Forks INTEGER, --
Watchers INTEGER, --
Id INTEGER not null primary key autoincrement,
ProcessedTime INTEGER, --
Url TEXT, --
);
CREATE TABLE Solution
(
WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
Id INTEGER not null primary key autoincrement,
RepoId INTEGER, --
ProcessedTime INTEGER, --
Path TEXT, --
);
CREATE TABLE MethodParameter
(
Name TEXT, --
MethodId TEXT, --
Id INTEGER not null primary key autoincrement,
Type TEXT, --
); |
olympics | What is the percentage of the people who are under 35 and participated in the summer season? | DIVIDE(COUNT(age < 35) / COUNT(person_id)) as percentage where season = 'Summer'; | SELECT CAST(COUNT(CASE WHEN T2.age < 35 THEN 1 END) AS REAL) * 100 / COUNT(T2.games_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.season = 'Summer' | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
codebase_comments | How many followers do the most followed repository on Github have? Give the github address of the repository. | more forks refers to more people follow this repository; most followed repository refers to max(Forks); the github address of the repository refers to Url; | SELECT Forks, Url FROM Repo WHERE Forks = ( SELECT MAX(Forks) FROM Repo ) | CREATE TABLE Method
(
ApiCalls TEXT, --
NameTokenized TEXT, --
Name TEXT, --
SolutionId INTEGER, --
CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
SampledAt INTEGER, --
Id INTEGER not null primary key autoincrement,
Lang TEXT, --
FullComment TEXT, --
Summary TEXT, --
);
CREATE TABLE Repo
(
Stars INTEGER, --
Forks INTEGER, --
Watchers INTEGER, --
Id INTEGER not null primary key autoincrement,
ProcessedTime INTEGER, --
Url TEXT, --
);
CREATE TABLE Solution
(
WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
Id INTEGER not null primary key autoincrement,
RepoId INTEGER, --
ProcessedTime INTEGER, --
Path TEXT, --
);
CREATE TABLE MethodParameter
(
Name TEXT, --
MethodId TEXT, --
Id INTEGER not null primary key autoincrement,
Type TEXT, --
); |
codebase_comments | What is the github address of the "nofear_Mara\Mara.sln" solution path? | github address of repository refers to Url; | SELECT Url FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE Path = 'nofear_MaraMara.sln' | CREATE TABLE Method
(
ApiCalls TEXT, --
NameTokenized TEXT, --
Name TEXT, --
SolutionId INTEGER, --
CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
SampledAt INTEGER, --
Id INTEGER not null primary key autoincrement,
Lang TEXT, --
FullComment TEXT, --
Summary TEXT, --
);
CREATE TABLE Repo
(
Stars INTEGER, --
Forks INTEGER, --
Watchers INTEGER, --
Id INTEGER not null primary key autoincrement,
ProcessedTime INTEGER, --
Url TEXT, --
);
CREATE TABLE Solution
(
WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
Id INTEGER not null primary key autoincrement,
RepoId INTEGER, --
ProcessedTime INTEGER, --
Path TEXT, --
);
CREATE TABLE MethodParameter
(
Name TEXT, --
MethodId TEXT, --
Id INTEGER not null primary key autoincrement,
Type TEXT, --
); |
address | Which state is area code 878 in? Give the name of the state. | null | SELECT T2.state FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 878 | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
codebase_comments | What is the most liked repository? Indicate its github address and the amount of stars it has received. | more stars mean more people like this repository; most liked refers to max(Stars); the github address of repository refers to Url; | SELECT Url, Stars FROM Repo WHERE Stars = ( SELECT MAX(Stars) FROM Repo ) | CREATE TABLE Method
(
ApiCalls TEXT, --
NameTokenized TEXT, --
Name TEXT, --
SolutionId INTEGER, --
CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
SampledAt INTEGER, --
Id INTEGER not null primary key autoincrement,
Lang TEXT, --
FullComment TEXT, --
Summary TEXT, --
);
CREATE TABLE Repo
(
Stars INTEGER, --
Forks INTEGER, --
Watchers INTEGER, --
Id INTEGER not null primary key autoincrement,
ProcessedTime INTEGER, --
Url TEXT, --
);
CREATE TABLE Solution
(
WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
Id INTEGER not null primary key autoincrement,
RepoId INTEGER, --
ProcessedTime INTEGER, --
Path TEXT, --
);
CREATE TABLE MethodParameter
(
Name TEXT, --
MethodId TEXT, --
Id INTEGER not null primary key autoincrement,
Type TEXT, --
); |
codebase_comments | What is the tokenized name of the solution whose path is "maravillas_linq-to-delicious\tasty.sln"? | tokenized name refers to NameTokenized | SELECT DISTINCT T2.NameTokenized FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T1.Path = 'maravillas_linq-to-delicious' | CREATE TABLE Method
(
ApiCalls TEXT, --
NameTokenized TEXT, --
Name TEXT, --
SolutionId INTEGER, --
CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
SampledAt INTEGER, --
Id INTEGER not null primary key autoincrement,
Lang TEXT, --
FullComment TEXT, --
Summary TEXT, --
);
CREATE TABLE Repo
(
Stars INTEGER, --
Forks INTEGER, --
Watchers INTEGER, --
Id INTEGER not null primary key autoincrement,
ProcessedTime INTEGER, --
Url TEXT, --
);
CREATE TABLE Solution
(
WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
Id INTEGER not null primary key autoincrement,
RepoId INTEGER, --
ProcessedTime INTEGER, --
Path TEXT, --
);
CREATE TABLE MethodParameter
(
Name TEXT, --
MethodId TEXT, --
Id INTEGER not null primary key autoincrement,
Type TEXT, --
); |
address | For the city with the most elders, what's its area code? | city with most elders refers to Max(over_65) | SELECT T2.area_code FROM zip_data AS T1 INNER JOIN area_code AS T2 ON T1.zip_code = T2.zip_code GROUP BY T2.area_code ORDER BY T1.over_65 DESC LIMIT 1 | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
codebase_comments | How much is the processed time of downloading the most popular repository? | more watchers mean that this repository is more popular; | SELECT ProcessedTime FROM Repo WHERE Watchers = ( SELECT MAX(Watchers) FROM Repo ) | CREATE TABLE Method
(
ApiCalls TEXT, --
NameTokenized TEXT, --
Name TEXT, --
SolutionId INTEGER, --
CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
SampledAt INTEGER, --
Id INTEGER not null primary key autoincrement,
Lang TEXT, --
FullComment TEXT, --
Summary TEXT, --
);
CREATE TABLE Repo
(
Stars INTEGER, --
Forks INTEGER, --
Watchers INTEGER, --
Id INTEGER not null primary key autoincrement,
ProcessedTime INTEGER, --
Url TEXT, --
);
CREATE TABLE Solution
(
WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
Id INTEGER not null primary key autoincrement,
RepoId INTEGER, --
ProcessedTime INTEGER, --
Path TEXT, --
);
CREATE TABLE MethodParameter
(
Name TEXT, --
MethodId TEXT, --
Id INTEGER not null primary key autoincrement,
Type TEXT, --
); |
codebase_comments | In the "https://github.com/wallerdev/htmlsharp.git", give all the linearized sequenced of API calls. | linearized sequenced of API calls refers to ApiCalls; 'https://github.com/wallerdev/htmlsharp.git' is url of repository | SELECT T3.ApiCalls FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId INNER JOIN Method AS T3 ON T2.Id = T3.SolutionId WHERE T1.Url = 'https://github.com/wallerdev/htmlsharp.git' | CREATE TABLE Method
(
ApiCalls TEXT, --
NameTokenized TEXT, --
Name TEXT, --
SolutionId INTEGER, --
CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
SampledAt INTEGER, --
Id INTEGER not null primary key autoincrement,
Lang TEXT, --
FullComment TEXT, --
Summary TEXT, --
);
CREATE TABLE Repo
(
Stars INTEGER, --
Forks INTEGER, --
Watchers INTEGER, --
Id INTEGER not null primary key autoincrement,
ProcessedTime INTEGER, --
Url TEXT, --
);
CREATE TABLE Solution
(
WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
Id INTEGER not null primary key autoincrement,
RepoId INTEGER, --
ProcessedTime INTEGER, --
Path TEXT, --
);
CREATE TABLE MethodParameter
(
Name TEXT, --
MethodId TEXT, --
Id INTEGER not null primary key autoincrement,
Type TEXT, --
); |
address | Give the name and the position of the cbsa officer from the area with the zip code 45503. | position refers to latitude, longitude | SELECT T1.CBSA_name, T2.latitude, T2.longitude FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.zip_code = 45503 GROUP BY T1.CBSA_name, T2.latitude, T2.longitude | CREATE TABLE state
(
name TEXT, --
abbreviation TEXT primary key,
);
CREATE TABLE country
(
zip_code INTEGER, --
foreign key (state) references state(abbreviation),
county TEXT, --
primary key (zip_code, county),
state TEXT, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE area_code
(
primary key (zip_code, area_code),
zip_code INTEGER, --
area_code INTEGER, --
foreign key (zip_code) references zip_data(zip_code),
);
CREATE TABLE congress
(
House TEXT, -- Example Values: `House of Repsentatives`, `Senate` | Value Statics: Total count 540 - Distinct count 2 - Null count 0
District INTEGER, --
land_area REAL, --
party TEXT, -- Example Values: `Republican`, `Democrat`, `Independent` | Value Statics: Total count 540 - Distinct count 3 - Null count 0
abbreviation TEXT, --
state TEXT, --
cognress_rep_id TEXT primary key,
CID TEXT, --
foreign key (abbreviation) references state(abbreviation),
first_name TEXT, --
last_name TEXT, --
);
CREATE TABLE avoid
(
primary key (zip_code, bad_alias),
bad_alias TEXT, --
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE zip_data
(
population_2010 INTEGER, --
"1st_quarter_payroll" INTEGER, --
residential_mailboxes INTEGER, --
american_indian_population INTEGER, --
spouses INTEGER, --
over_65 INTEGER, --
employees INTEGER, --
white_population INTEGER, --
multi_county TEXT, -- Example Values: `No`, `Yes` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
businesses INTEGER, --
black_population INTEGER, --
avg_house_value INTEGER, --
children INTEGER, --
foreign key (state) references state(abbreviation),
single_family_delivery_units INTEGER, --
time_zone TEXT, -- Example Values: `Eastern`, `Atlantic`, `Central`, `Mountain`, `Pacific` | Value Statics: Total count 40955 - Distinct count 12 - Null count 608
parents_and_widowed INTEGER, --
state_fips INTEGER, --
monthly_benefits_all INTEGER, --
male_population INTEGER, --
type TEXT, -- Example Values: `Unique Post Office`, `Post Office`, `P.O. Box Only`, `Branch`, `Non Postal Community Name` | Value Statics: Total count 41563 - Distinct count 9 - Null count 0
population_2020 INTEGER, --
other_population INTEGER, --
avg_income_per_household INTEGER, --
daylight_savings TEXT, -- Example Values: `Yes`, `No` | Value Statics: Total count 41563 - Distinct count 2 - Null count 0
female_median_age REAL, --
annual_payroll INTEGER, --
female_population INTEGER, --
persons_per_household REAL, --
division TEXT, -- Example Values: `Middle Atlantic`, `New England`, `South Atlantic`, `East South Central`, `East North Central` | Value Statics: Total count 40725 - Distinct count 9 - Null count 838
city TEXT, --
total_delivery_receptacles INTEGER, --
organization TEXT, --
state TEXT, --
monthly_benefits_retired_workers INTEGER, --
foreign key (CBSA) references CBSA(CBSA),
asian_population INTEGER, --
hispanic_population INTEGER, --
male_median_age REAL, --
region TEXT, -- Example Values: `Northeast`, `South`, `Midwest`, `West` | Value Statics: Total count 40725 - Distinct count 4 - Null count 838
county_fips INTEGER, --
median_age REAL, --
retired_workers INTEGER, --
total_beneficiaries INTEGER, --
latitude REAL, --
households INTEGER, --
hawaiian_population INTEGER, --
monthly_benefits_widowed INTEGER, --
water_area REAL, --
business_mailboxes INTEGER, --
longitude REAL, --
multi_family_delivery_units INTEGER, --
CBSA INTEGER, --
zip_code INTEGER primary key,
elevation INTEGER, --
land_area REAL, --
disabled_workers INTEGER, --
);
CREATE TABLE alias
(
foreign key (zip_code) references zip_data(zip_code),
alias TEXT, --
zip_code INTEGER primary key,
);
CREATE TABLE zip_congress
(
district TEXT, --
foreign key (district) references congress(cognress_rep_id),
primary key (zip_code, district),
foreign key (zip_code) references zip_data(zip_code),
zip_code INTEGER, --
);
CREATE TABLE CBSA
(
CBSA_type TEXT, -- Example Values: `Micro`, `Metro` | Value Statics: Total count 465 - Distinct count 2 - Null count 0
CBSA INTEGER primary key,
CBSA_name TEXT, --
); |
codebase_comments | Which repository has the longest amount of processed time of downloading? Indicate whether the solution paths in the repository can be implemented without needs of compilation. | longest amount of processed time refers to max(ProcessedTime); the repository can be implemented without needs of compilation refers to WasCompiled = 1; | SELECT DISTINCT T1.id, T2.WasCompiled FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId WHERE T1.ProcessedTime = ( SELECT MAX(ProcessedTime) FROM Repo ) | CREATE TABLE Method
(
ApiCalls TEXT, --
NameTokenized TEXT, --
Name TEXT, --
SolutionId INTEGER, --
CommentIsXml INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
SampledAt INTEGER, --
Id INTEGER not null primary key autoincrement,
Lang TEXT, --
FullComment TEXT, --
Summary TEXT, --
);
CREATE TABLE Repo
(
Stars INTEGER, --
Forks INTEGER, --
Watchers INTEGER, --
Id INTEGER not null primary key autoincrement,
ProcessedTime INTEGER, --
Url TEXT, --
);
CREATE TABLE Solution
(
WasCompiled INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
Id INTEGER not null primary key autoincrement,
RepoId INTEGER, --
ProcessedTime INTEGER, --
Path TEXT, --
);
CREATE TABLE MethodParameter
(
Name TEXT, --
MethodId TEXT, --
Id INTEGER not null primary key autoincrement,
Type TEXT, --
); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.