Dludora/DAIL-BIRD huggingface dataset:
/* Given the following database schema: */
CREATE TABLE characters
(
    movie_title  TEXT
            primary key,
    release_date TEXT,
    hero         TEXT,
    villian      TEXT,
    song         TEXT,
    foreign key (hero) references "voice-actors"(character)
)

CREATE TABLE director
(
    name     TEXT
            primary key,
    director TEXT,
    foreign key (name) references characters(movie_title)
)

CREATE TABLE movies_total_gross
(
    movie_title              TEXT,
    release_date             TEXT,
    genre                    TEXT,
    MPAA_rating              TEXT,
    total_gross              TEXT,
    inflation_adjusted_gross TEXT,
    primary key (movie_title, release_date),
    foreign key (movie_title) references characters(movie_title)
)

CREATE TABLE revenue
(
    Year                              INTEGER
            primary key,
    "Studio Entertainment[NI 1]"      REAL,
    "Disney Consumer Products[NI 2]"  REAL,
    "Disney Interactive[NI 3][Rev 1]" INTEGER,
    "Walt Disney Parks and Resorts"   REAL,
    "Disney Media Networks"           TEXT,
    Total                             INTEGER
)

CREATE TABLE "voice-actors"
(
    character     TEXT
            primary key,
    "voice-actor" TEXT,
    movie         TEXT,
    foreign key (movie) references characters(movie_title)
)

/* Answer the following: What is Disney's highest grossing action movie? action movie refers to movie_title where genre = 'Action'; highest grossing movie refers to MAX(total_gross) */
SELECT 
SELECT movie_title FROM movies_total_gross WHERE genre = 'Action' ORDER BY CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1
/* Given the following database schema: */
CREATE TABLE characters
(
    movie_title  TEXT
            primary key,
    release_date TEXT,
    hero         TEXT,
    villian      TEXT,
    song         TEXT,
    foreign key (hero) references "voice-actors"(character)
)

CREATE TABLE director
(
    name     TEXT
            primary key,
    director TEXT,
    foreign key (name) references characters(movie_title)
)

CREATE TABLE movies_total_gross
(
    movie_title              TEXT,
    release_date             TEXT,
    genre                    TEXT,
    MPAA_rating              TEXT,
    total_gross              TEXT,
    inflation_adjusted_gross TEXT,
    primary key (movie_title, release_date),
    foreign key (movie_title) references characters(movie_title)
)

CREATE TABLE revenue
(
    Year                              INTEGER
            primary key,
    "Studio Entertainment[NI 1]"      REAL,
    "Disney Consumer Products[NI 2]"  REAL,
    "Disney Interactive[NI 3][Rev 1]" INTEGER,
    "Walt Disney Parks and Resorts"   REAL,
    "Disney Media Networks"           TEXT,
    Total                             INTEGER
)

CREATE TABLE "voice-actors"
(
    character     TEXT
            primary key,
    "voice-actor" TEXT,
    movie         TEXT,
    foreign key (movie) references characters(movie_title)
)

/* Answer the following: Which actor voices Akela from The Jungle Book? Akela refers character = 'Akela'; which actor voices refers to voice-actor; */
SELECT 
SELECT `voice-actor` FROM `voice-actors` WHERE character = 'Akela'
/* Given the following database schema: */
CREATE TABLE characters
(
    movie_title  TEXT
            primary key,
    release_date TEXT,
    hero         TEXT,
    villian      TEXT,
    song         TEXT,
    foreign key (hero) references "voice-actors"(character)
)

CREATE TABLE director
(
    name     TEXT
            primary key,
    director TEXT,
    foreign key (name) references characters(movie_title)
)

CREATE TABLE movies_total_gross
(
    movie_title              TEXT,
    release_date             TEXT,
    genre                    TEXT,
    MPAA_rating              TEXT,
    total_gross              TEXT,
    inflation_adjusted_gross TEXT,
    primary key (movie_title, release_date),
    foreign key (movie_title) references characters(movie_title)
)

CREATE TABLE revenue
(
    Year                              INTEGER
            primary key,
    "Studio Entertainment[NI 1]"      REAL,
    "Disney Consumer Products[NI 2]"  REAL,
    "Disney Interactive[NI 3][Rev 1]" INTEGER,
    "Walt Disney Parks and Resorts"   REAL,
    "Disney Media Networks"           TEXT,
    Total                             INTEGER
)

CREATE TABLE "voice-actors"
(
    character     TEXT
            primary key,
    "voice-actor" TEXT,
    movie         TEXT,
    foreign key (movie) references characters(movie_title)
)

/* Answer the following: Determine Disney's total box office gross between 2010 and 2016. between 2010 and 2016 refers to Year between 2010 and 2016; */
SELECT 
SELECT SUM(Total) FROM revenue WHERE `Year` BETWEEN 2010 AND 2016
/* Given the following database schema: */
CREATE TABLE characters
(
    movie_title  TEXT
            primary key,
    release_date TEXT,
    hero         TEXT,
    villian      TEXT,
    song         TEXT,
    foreign key (hero) references "voice-actors"(character)
)

CREATE TABLE director
(
    name     TEXT
            primary key,
    director TEXT,
    foreign key (name) references characters(movie_title)
)

CREATE TABLE movies_total_gross
(
    movie_title              TEXT,
    release_date             TEXT,
    genre                    TEXT,
    MPAA_rating              TEXT,
    total_gross              TEXT,
    inflation_adjusted_gross TEXT,
    primary key (movie_title, release_date),
    foreign key (movie_title) references characters(movie_title)
)

CREATE TABLE revenue
(
    Year                              INTEGER
            primary key,
    "Studio Entertainment[NI 1]"      REAL,
    "Disney Consumer Products[NI 2]"  REAL,
    "Disney Interactive[NI 3][Rev 1]" INTEGER,
    "Walt Disney Parks and Resorts"   REAL,
    "Disney Media Networks"           TEXT,
    Total                             INTEGER
)

CREATE TABLE "voice-actors"
(
    character     TEXT
            primary key,
    "voice-actor" TEXT,
    movie         TEXT,
    foreign key (movie) references characters(movie_title)
)

/* Answer the following: Name the main character of Disney's most popular adventure movie based on its inflation-adjusted gross. adventure movie refers to genre = 'Adventure'; the main character of the movie refers to hero; most popular movie based on its inflation-adjusted gross refers to where MAX(inflation_adjusted_gross); */
SELECT 
SELECT T2.hero FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title WHERE T1.genre = 'Adventure' ORDER BY CAST(REPLACE(trim(T1.inflation_adjusted_gross, '$'), ',', '') AS REAL) DESC LIMIT 1
/* Given the following database schema: */
CREATE TABLE characters
(
    movie_title  TEXT
            primary key,
    release_date TEXT,
    hero         TEXT,
    villian      TEXT,
    song         TEXT,
    foreign key (hero) references "voice-actors"(character)
)

CREATE TABLE director
(
    name     TEXT
            primary key,
    director TEXT,
    foreign key (name) references characters(movie_title)
)

CREATE TABLE movies_total_gross
(
    movie_title              TEXT,
    release_date             TEXT,
    genre                    TEXT,
    MPAA_rating              TEXT,
    total_gross              TEXT,
    inflation_adjusted_gross TEXT,
    primary key (movie_title, release_date),
    foreign key (movie_title) references characters(movie_title)
)

CREATE TABLE revenue
(
    Year                              INTEGER
            primary key,
    "Studio Entertainment[NI 1]"      REAL,
    "Disney Consumer Products[NI 2]"  REAL,
    "Disney Interactive[NI 3][Rev 1]" INTEGER,
    "Walt Disney Parks and Resorts"   REAL,
    "Disney Media Networks"           TEXT,
    Total                             INTEGER
)

CREATE TABLE "voice-actors"
(
    character     TEXT
            primary key,
    "voice-actor" TEXT,
    movie         TEXT,
    foreign key (movie) references characters(movie_title)
)

/* Answer the following: Name the director of Disney's lowest grossing movie. lowest grossing movie refers to movie_title where MIN(total_gross); */
SELECT 
SELECT T2.director FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name ORDER BY CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) ASC LIMIT 1
/* Given the following database schema: */
CREATE TABLE characters
(
    movie_title  TEXT
            primary key,
    release_date TEXT,
    hero         TEXT,
    villian      TEXT,
    song         TEXT,
    foreign key (hero) references "voice-actors"(character)
)

CREATE TABLE director
(
    name     TEXT
            primary key,
    director TEXT,
    foreign key (name) references characters(movie_title)
)

CREATE TABLE movies_total_gross
(
    movie_title              TEXT,
    release_date             TEXT,
    genre                    TEXT,
    MPAA_rating              TEXT,
    total_gross              TEXT,
    inflation_adjusted_gross TEXT,
    primary key (movie_title, release_date),
    foreign key (movie_title) references characters(movie_title)
)

CREATE TABLE revenue
(
    Year                              INTEGER
            primary key,
    "Studio Entertainment[NI 1]"      REAL,
    "Disney Consumer Products[NI 2]"  REAL,
    "Disney Interactive[NI 3][Rev 1]" INTEGER,
    "Walt Disney Parks and Resorts"   REAL,
    "Disney Media Networks"           TEXT,
    Total                             INTEGER
)

CREATE TABLE "voice-actors"
(
    character     TEXT
            primary key,
    "voice-actor" TEXT,
    movie         TEXT,
    foreign key (movie) references characters(movie_title)
)

/* Answer the following: Find out what proportion of total revenue Walt Disney Parks and Resorts received in 2010. DIVIDE(Walt Disney Parks and Resorts where year = 2010), SUM(year = 2010) as percentage; */
SELECT 
SELECT SUM(`Walt Disney Parks and Resorts`) / SUM(Total) * 100 FROM revenue WHERE year = 2010
/* Given the following database schema: */
CREATE TABLE characters
(
    movie_title  TEXT
            primary key,
    release_date TEXT,
    hero         TEXT,
    villian      TEXT,
    song         TEXT,
    foreign key (hero) references "voice-actors"(character)
)

CREATE TABLE director
(
    name     TEXT
            primary key,
    director TEXT,
    foreign key (name) references characters(movie_title)
)

CREATE TABLE movies_total_gross
(
    movie_title              TEXT,
    release_date             TEXT,
    genre                    TEXT,
    MPAA_rating              TEXT,
    total_gross              TEXT,
    inflation_adjusted_gross TEXT,
    primary key (movie_title, release_date),
    foreign key (movie_title) references characters(movie_title)
)

CREATE TABLE revenue
(
    Year                              INTEGER
            primary key,
    "Studio Entertainment[NI 1]"      REAL,
    "Disney Consumer Products[NI 2]"  REAL,
    "Disney Interactive[NI 3][Rev 1]" INTEGER,
    "Walt Disney Parks and Resorts"   REAL,
    "Disney Media Networks"           TEXT,
    Total                             INTEGER
)

CREATE TABLE "voice-actors"
(
    character     TEXT
            primary key,
    "voice-actor" TEXT,
    movie         TEXT,
    foreign key (movie) references characters(movie_title)
)

/* Answer the following: Determine the average gross for Disney's PG-13-rated action movies. DIVIDE(SUM(total_gross where genre = 'Action' and MPAA_rating = 'PG-13'), COUNT(movie_title where genre = 'Action' and MPAA_rating = 'PG-13')); */
SELECT 
SELECT SUM(CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL)) / COUNT(movie_title) FROM movies_total_gross WHERE MPAA_rating = 'PG-13'
/* Given the following database schema: */
CREATE TABLE characters
(
    movie_title  TEXT
            primary key,
    release_date TEXT,
    hero         TEXT,
    villian      TEXT,
    song         TEXT,
    foreign key (hero) references "voice-actors"(character)
)

CREATE TABLE director
(
    name     TEXT
            primary key,
    director TEXT,
    foreign key (name) references characters(movie_title)
)

CREATE TABLE movies_total_gross
(
    movie_title              TEXT,
    release_date             TEXT,
    genre                    TEXT,
    MPAA_rating              TEXT,
    total_gross              TEXT,
    inflation_adjusted_gross TEXT,
    primary key (movie_title, release_date),
    foreign key (movie_title) references characters(movie_title)
)

CREATE TABLE revenue
(
    Year                              INTEGER
            primary key,
    "Studio Entertainment[NI 1]"      REAL,
    "Disney Consumer Products[NI 2]"  REAL,
    "Disney Interactive[NI 3][Rev 1]" INTEGER,
    "Walt Disney Parks and Resorts"   REAL,
    "Disney Media Networks"           TEXT,
    Total                             INTEGER
)

CREATE TABLE "voice-actors"
(
    character     TEXT
            primary key,
    "voice-actor" TEXT,
    movie         TEXT,
    foreign key (movie) references characters(movie_title)
)

/* Answer the following: How many voice-actors were involved in the Bambi movie? Bambi is the name of the movie which refers to movie = 'Bambi'; */
SELECT 
SELECT COUNT(DISTINCT 'voice-actor') FROM `voice-actors` WHERE movie = 'Bambi'
/* Given the following database schema: */
CREATE TABLE characters
(
    movie_title  TEXT
            primary key,
    release_date TEXT,
    hero         TEXT,
    villian      TEXT,
    song         TEXT,
    foreign key (hero) references "voice-actors"(character)
)

CREATE TABLE director
(
    name     TEXT
            primary key,
    director TEXT,
    foreign key (name) references characters(movie_title)
)

CREATE TABLE movies_total_gross
(
    movie_title              TEXT,
    release_date             TEXT,
    genre                    TEXT,
    MPAA_rating              TEXT,
    total_gross              TEXT,
    inflation_adjusted_gross TEXT,
    primary key (movie_title, release_date),
    foreign key (movie_title) references characters(movie_title)
)

CREATE TABLE revenue
(
    Year                              INTEGER
            primary key,
    "Studio Entertainment[NI 1]"      REAL,
    "Disney Consumer Products[NI 2]"  REAL,
    "Disney Interactive[NI 3][Rev 1]" INTEGER,
    "Walt Disney Parks and Resorts"   REAL,
    "Disney Media Networks"           TEXT,
    Total                             INTEGER
)

CREATE TABLE "voice-actors"
(
    character     TEXT
            primary key,
    "voice-actor" TEXT,
    movie         TEXT,
    foreign key (movie) references characters(movie_title)
)

/* Answer the following: Find the estimated inflation rate that was used to adjust the 1995 box office revenue for Disney's films. DIVIDE(inflation_adjusted_gross, total_gross) as percentage where substr(release_date, length(release_date) - 3, length(release_date)) = '1995'; */
SELECT 
SELECT SUM(CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL)) / SUM(CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL)) FROM movies_total_gross WHERE SUBSTR(release_date, LENGTH(release_date) - 3, LENGTH(release_date)) = '1995' GROUP BY SUBSTR(release_date, LENGTH(release_date) - 3, LENGTH(release_date)) = '1995'
/* Given the following database schema: */
CREATE TABLE characters
(
    movie_title  TEXT
            primary key,
    release_date TEXT,
    hero         TEXT,
    villian      TEXT,
    song         TEXT,
    foreign key (hero) references "voice-actors"(character)
)

CREATE TABLE director
(
    name     TEXT
            primary key,
    director TEXT,
    foreign key (name) references characters(movie_title)
)

CREATE TABLE movies_total_gross
(
    movie_title              TEXT,
    release_date             TEXT,
    genre                    TEXT,
    MPAA_rating              TEXT,
    total_gross              TEXT,
    inflation_adjusted_gross TEXT,
    primary key (movie_title, release_date),
    foreign key (movie_title) references characters(movie_title)
)

CREATE TABLE revenue
(
    Year                              INTEGER
            primary key,
    "Studio Entertainment[NI 1]"      REAL,
    "Disney Consumer Products[NI 2]"  REAL,
    "Disney Interactive[NI 3][Rev 1]" INTEGER,
    "Walt Disney Parks and Resorts"   REAL,
    "Disney Media Networks"           TEXT,
    Total                             INTEGER
)

CREATE TABLE "voice-actors"
(
    character     TEXT
            primary key,
    "voice-actor" TEXT,
    movie         TEXT,
    foreign key (movie) references characters(movie_title)
)

/* Answer the following: What is the difference in the current gross of Cars and its sequel, Cars 2? Which movie is more popular? SUBTRACT(inflation_adjusted_gross where movie_title = 'Cars', inflation_adjusted_gross where movie_title = 'Cars 2'); more popular movie refers to movie_title where MAX(inflation_adjusted_gross); */
SELECT 
SELECT SUM(CASE WHEN movie_title = 'Cars' THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END), SUM(CASE WHEN movie_title = 'Cars 2' THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END) FROM movies_total_gross
/* Given the following database schema: */
CREATE TABLE characters
(
    movie_title  TEXT
            primary key,
    release_date TEXT,
    hero         TEXT,
    villian      TEXT,
    song         TEXT,
    foreign key (hero) references "voice-actors"(character)
)

CREATE TABLE director
(
    name     TEXT
            primary key,
    director TEXT,
    foreign key (name) references characters(movie_title)
)

CREATE TABLE movies_total_gross
(
    movie_title              TEXT,
    release_date             TEXT,
    genre                    TEXT,
    MPAA_rating              TEXT,
    total_gross              TEXT,
    inflation_adjusted_gross TEXT,
    primary key (movie_title, release_date),
    foreign key (movie_title) references characters(movie_title)
)

CREATE TABLE revenue
(
    Year                              INTEGER
            primary key,
    "Studio Entertainment[NI 1]"      REAL,
    "Disney Consumer Products[NI 2]"  REAL,
    "Disney Interactive[NI 3][Rev 1]" INTEGER,
    "Walt Disney Parks and Resorts"   REAL,
    "Disney Media Networks"           TEXT,
    Total                             INTEGER
)

CREATE TABLE "voice-actors"
(
    character     TEXT
            primary key,
    "voice-actor" TEXT,
    movie         TEXT,
    foreign key (movie) references characters(movie_title)
)

/* Answer the following: Name the most recent movie directed by Chris Buck. Which of his movies was more successful in terms of grossing? Use the current gross for comparison. Chris Buck refers to director = 'Chris Buck'; the most recent movie refers to movie_title where MAX(release_date); current gross refers to inflation_adjusted_gross; more successful movie refers to MAX(inflation_adjusted_gross); */
SELECT 
SELECT T1.movie_title, MAX(T1.release_date), MAX(T1.inflation_adjusted_gross) FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Chris Buck'
/* Given the following database schema: */
CREATE TABLE characters
(
    movie_title  TEXT
            primary key,
    release_date TEXT,
    hero         TEXT,
    villian      TEXT,
    song         TEXT,
    foreign key (hero) references "voice-actors"(character)
)

CREATE TABLE director
(
    name     TEXT
            primary key,
    director TEXT,
    foreign key (name) references characters(movie_title)
)

CREATE TABLE movies_total_gross
(
    movie_title              TEXT,
    release_date             TEXT,
    genre                    TEXT,
    MPAA_rating              TEXT,
    total_gross              TEXT,
    inflation_adjusted_gross TEXT,
    primary key (movie_title, release_date),
    foreign key (movie_title) references characters(movie_title)
)

CREATE TABLE revenue
(
    Year                              INTEGER
            primary key,
    "Studio Entertainment[NI 1]"      REAL,
    "Disney Consumer Products[NI 2]"  REAL,
    "Disney Interactive[NI 3][Rev 1]" INTEGER,
    "Walt Disney Parks and Resorts"   REAL,
    "Disney Media Networks"           TEXT,
    Total                             INTEGER
)

CREATE TABLE "voice-actors"
(
    character     TEXT
            primary key,
    "voice-actor" TEXT,
    movie         TEXT,
    foreign key (movie) references characters(movie_title)
)

/* Answer the following: Name actors who voiced more than five Disney characters. Actors who voiced refer to voice-actor; */
SELECT 
SELECT 'voice-actor' FROM `voice-actors` GROUP BY 'voice-actor' HAVING COUNT(movie) > 5
/* Given the following database schema: */
CREATE TABLE characters
(
    movie_title  TEXT
            primary key,
    release_date TEXT,
    hero         TEXT,
    villian      TEXT,
    song         TEXT,
    foreign key (hero) references "voice-actors"(character)
)

CREATE TABLE director
(
    name     TEXT
            primary key,
    director TEXT,
    foreign key (name) references characters(movie_title)
)

CREATE TABLE movies_total_gross
(
    movie_title              TEXT,
    release_date             TEXT,
    genre                    TEXT,
    MPAA_rating              TEXT,
    total_gross              TEXT,
    inflation_adjusted_gross TEXT,
    primary key (movie_title, release_date),
    foreign key (movie_title) references characters(movie_title)
)

CREATE TABLE revenue
(
    Year                              INTEGER
            primary key,
    "Studio Entertainment[NI 1]"      REAL,
    "Disney Consumer Products[NI 2]"  REAL,
    "Disney Interactive[NI 3][Rev 1]" INTEGER,
    "Walt Disney Parks and Resorts"   REAL,
    "Disney Media Networks"           TEXT,
    Total                             INTEGER
)

CREATE TABLE "voice-actors"
(
    character     TEXT
            primary key,
    "voice-actor" TEXT,
    movie         TEXT,
    foreign key (movie) references characters(movie_title)
)

/* Answer the following: Name the top 5 highest-grossing Disney movies adjusted for inflation. Identify the percentage they contributed to the total of Disney's current gross. The top 5 highest-grossing movies adjusted for inflation refer to MAX(inflation_adjusted_gross)LIMIT 5; DIVIDE(SUM(MAX(inflation_adjusted_gross LIMIT 5)), SUM(inflation_adjusted_gross)) as percentage; */
SELECT 
SELECT SUM(CASE WHEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) > 1236035515 THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END) * 100 / SUM(CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL)) FROM movies_total_gross
/* Given the following database schema: */
CREATE TABLE characters
(
    movie_title  TEXT
            primary key,
    release_date TEXT,
    hero         TEXT,
    villian      TEXT,
    song         TEXT,
    foreign key (hero) references "voice-actors"(character)
)

CREATE TABLE director
(
    name     TEXT
            primary key,
    director TEXT,
    foreign key (name) references characters(movie_title)
)

CREATE TABLE movies_total_gross
(
    movie_title              TEXT,
    release_date             TEXT,
    genre                    TEXT,
    MPAA_rating              TEXT,
    total_gross              TEXT,
    inflation_adjusted_gross TEXT,
    primary key (movie_title, release_date),
    foreign key (movie_title) references characters(movie_title)
)

CREATE TABLE revenue
(
    Year                              INTEGER
            primary key,
    "Studio Entertainment[NI 1]"      REAL,
    "Disney Consumer Products[NI 2]"  REAL,
    "Disney Interactive[NI 3][Rev 1]" INTEGER,
    "Walt Disney Parks and Resorts"   REAL,
    "Disney Media Networks"           TEXT,
    Total                             INTEGER
)

CREATE TABLE "voice-actors"
(
    character     TEXT
            primary key,
    "voice-actor" TEXT,
    movie         TEXT,
    foreign key (movie) references characters(movie_title)
)

/* Answer the following: Among all Disney movies directed by Gary Trousdale, determine the percentage that earned over USD100m based on actual grossing. DIVIDE(COUNT(movie_title where director = 'Gary Trousdale' and total_gross > 100000000), COUNT(movie_title where director = 'Gary Trousdale')) as percentage; */
SELECT 
SELECT CAST(COUNT(CASE WHEN CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) > 100000000 THEN T1.movie_title ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_title) FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Gary Trousdale'
/* Given the following database schema: */
CREATE TABLE city
(
    id        INTEGER not null
            primary key,
    city_name TEXT default NULL
)

CREATE TABLE games
(
    id         INTEGER not null
            primary key,
    games_year INTEGER          default NULL,
    games_name TEXT default NULL,
    season     TEXT default NULL
)

CREATE TABLE games_city
(
    games_id INTEGER default NULL,
    city_id  INTEGER default NULL,
    foreign key (city_id) references city(id),
    foreign key (games_id) references games(id)
)

CREATE TABLE medal
(
    id         INTEGER not null
            primary key,
    medal_name TEXT default NULL
)

CREATE TABLE noc_region
(
    id          INTEGER not null
            primary key,
    noc         TEXT   default NULL,
    region_name TEXT default NULL
)

CREATE TABLE person
(
    id        INTEGER not null
        primary key,
    full_name TEXT default NULL,
    gender    TEXT  default NULL,
    height    INTEGER          default NULL,
    weight    INTEGER          default NULL
)

CREATE TABLE games_competitor
(
    id        INTEGER not null
            primary key,
    games_id  INTEGER default NULL,
    person_id INTEGER default NULL,
    age       INTEGER default NULL,
    foreign key (games_id) references games(id),
    foreign key (person_id) references person(id)
)

CREATE TABLE person_region
(
    person_id INTEGER default NULL,
    region_id INTEGER default NULL,
    foreign key (person_id) references person(id),
    foreign key (region_id) references noc_region(id)
)

CREATE TABLE sport
(
    id         INTEGER not null
            primary key,
    sport_name TEXT default NULL
)

CREATE TABLE event
(
    id         INTEGER not null
            primary key,
    sport_id   INTEGER          default NULL,
    event_name TEXT default NULL,
    foreign key (sport_id) references sport(id)
)

CREATE TABLE competitor_event
(
    event_id      INTEGER default NULL,
    competitor_id INTEGER default NULL,
    medal_id      INTEGER default NULL,
    foreign key (competitor_id) references games_competitor(id),
    foreign key (event_id) references event(id),
    foreign key (medal_id) references medal(id)
)

/* Answer the following: Please list the names of all the Olympic games that John Aalberg has taken part in. name of the Olympic games refers to games_name; */
SELECT 
SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'John Aalberg'
/* Given the following database schema: */
CREATE TABLE city
(
    id        INTEGER not null
            primary key,
    city_name TEXT default NULL
)

CREATE TABLE games
(
    id         INTEGER not null
            primary key,
    games_year INTEGER          default NULL,
    games_name TEXT default NULL,
    season     TEXT default NULL
)

CREATE TABLE games_city
(
    games_id INTEGER default NULL,
    city_id  INTEGER default NULL,
    foreign key (city_id) references city(id),
    foreign key (games_id) references games(id)
)

CREATE TABLE medal
(
    id         INTEGER not null
            primary key,
    medal_name TEXT default NULL
)

CREATE TABLE noc_region
(
    id          INTEGER not null
            primary key,
    noc         TEXT   default NULL,
    region_name TEXT default NULL
)

CREATE TABLE person
(
    id        INTEGER not null
        primary key,
    full_name TEXT default NULL,
    gender    TEXT  default NULL,
    height    INTEGER          default NULL,
    weight    INTEGER          default NULL
)

CREATE TABLE games_competitor
(
    id        INTEGER not null
            primary key,
    games_id  INTEGER default NULL,
    person_id INTEGER default NULL,
    age       INTEGER default NULL,
    foreign key (games_id) references games(id),
    foreign key (person_id) references person(id)
)

CREATE TABLE person_region
(
    person_id INTEGER default NULL,
    region_id INTEGER default NULL,
    foreign key (person_id) references person(id),
    foreign key (region_id) references noc_region(id)
)

CREATE TABLE sport
(
    id         INTEGER not null
            primary key,
    sport_name TEXT default NULL
)

CREATE TABLE event
(
    id         INTEGER not null
            primary key,
    sport_id   INTEGER          default NULL,
    event_name TEXT default NULL,
    foreign key (sport_id) references sport(id)
)

CREATE TABLE competitor_event
(
    event_id      INTEGER default NULL,
    competitor_id INTEGER default NULL,
    medal_id      INTEGER default NULL,
    foreign key (competitor_id) references games_competitor(id),
    foreign key (event_id) references event(id),
    foreign key (medal_id) references medal(id)
)

/* Answer the following: What was the name of the Olympic game that John Aalberg took part in when he was 31? when he was 31 refers to age = 31; name of the Olympic games refers to games_name; */
SELECT 
SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'John Aalberg' AND T2.age = 31
/* Given the following database schema: */
CREATE TABLE city
(
    id        INTEGER not null
            primary key,
    city_name TEXT default NULL
)

CREATE TABLE games
(
    id         INTEGER not null
            primary key,
    games_year INTEGER          default NULL,
    games_name TEXT default NULL,
    season     TEXT default NULL
)

CREATE TABLE games_city
(
    games_id INTEGER default NULL,
    city_id  INTEGER default NULL,
    foreign key (city_id) references city(id),
    foreign key (games_id) references games(id)
)

CREATE TABLE medal
(
    id         INTEGER not null
            primary key,
    medal_name TEXT default NULL
)

CREATE TABLE noc_region
(
    id          INTEGER not null
            primary key,
    noc         TEXT   default NULL,
    region_name TEXT default NULL
)

CREATE TABLE person
(
    id        INTEGER not null
        primary key,
    full_name TEXT default NULL,
    gender    TEXT  default NULL,
    height    INTEGER          default NULL,
    weight    INTEGER          default NULL
)

CREATE TABLE games_competitor
(
    id        INTEGER not null
            primary key,
    games_id  INTEGER default NULL,
    person_id INTEGER default NULL,
    age       INTEGER default NULL,
    foreign key (games_id) references games(id),
    foreign key (person_id) references person(id)
)

CREATE TABLE person_region
(
    person_id INTEGER default NULL,
    region_id INTEGER default NULL,
    foreign key (person_id) references person(id),
    foreign key (region_id) references noc_region(id)
)

CREATE TABLE sport
(
    id         INTEGER not null
            primary key,
    sport_name TEXT default NULL
)

CREATE TABLE event
(
    id         INTEGER not null
            primary key,
    sport_id   INTEGER          default NULL,
    event_name TEXT default NULL,
    foreign key (sport_id) references sport(id)
)

CREATE TABLE competitor_event
(
    event_id      INTEGER default NULL,
    competitor_id INTEGER default NULL,
    medal_id      INTEGER default NULL,
    foreign key (competitor_id) references games_competitor(id),
    foreign key (event_id) references event(id),
    foreign key (medal_id) references medal(id)
)

/* Answer the following: When John Aalberg took part in the 1994 Winter Olympic Game, how old was he? how old was he refers to age; 1994 Winter refers to games_name = '1994 Winter'; */
SELECT 
SELECT T2.age FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'John Aalberg' AND T1.games_name = '1994 Winter'
/* Given the following database schema: */
CREATE TABLE city
(
    id        INTEGER not null
            primary key,
    city_name TEXT default NULL
)

CREATE TABLE games
(
    id         INTEGER not null
            primary key,
    games_year INTEGER          default NULL,
    games_name TEXT default NULL,
    season     TEXT default NULL
)

CREATE TABLE games_city
(
    games_id INTEGER default NULL,
    city_id  INTEGER default NULL,
    foreign key (city_id) references city(id),
    foreign key (games_id) references games(id)
)

CREATE TABLE medal
(
    id         INTEGER not null
            primary key,
    medal_name TEXT default NULL
)

CREATE TABLE noc_region
(
    id          INTEGER not null
            primary key,
    noc         TEXT   default NULL,
    region_name TEXT default NULL
)

CREATE TABLE person
(
    id        INTEGER not null
        primary key,
    full_name TEXT default NULL,
    gender    TEXT  default NULL,
    height    INTEGER          default NULL,
    weight    INTEGER          default NULL
)

CREATE TABLE games_competitor
(
    id        INTEGER not null
            primary key,
    games_id  INTEGER default NULL,
    person_id INTEGER default NULL,
    age       INTEGER default NULL,
    foreign key (games_id) references games(id),
    foreign key (person_id) references person(id)
)

CREATE TABLE person_region
(
    person_id INTEGER default NULL,
    region_id INTEGER default NULL,
    foreign key (person_id) references person(id),
    foreign key (region_id) references noc_region(id)
)

CREATE TABLE sport
(
    id         INTEGER not null
            primary key,
    sport_name TEXT default NULL
)

CREATE TABLE event
(
    id         INTEGER not null
            primary key,
    sport_id   INTEGER          default NULL,
    event_name TEXT default NULL,
    foreign key (sport_id) references sport(id)
)

CREATE TABLE competitor_event
(
    event_id      INTEGER default NULL,
    competitor_id INTEGER default NULL,
    medal_id      INTEGER default NULL,
    foreign key (competitor_id) references games_competitor(id),
    foreign key (event_id) references event(id),
    foreign key (medal_id) references medal(id)
)

/* Answer the following: How many Olympic competitors are from Finland? competitors refer to person_id; from Finland refers to region_name = 'Finland'; */
SELECT 
SELECT COUNT(T1.person_id) FROM person_region AS T1 INNER JOIN noc_region AS T2 ON T1.region_id = T2.id WHERE T2.region_name = 'Finland'
/* Given the following database schema: */
CREATE TABLE city
(
    id        INTEGER not null
            primary key,
    city_name TEXT default NULL
)

CREATE TABLE games
(
    id         INTEGER not null
            primary key,
    games_year INTEGER          default NULL,
    games_name TEXT default NULL,
    season     TEXT default NULL
)

CREATE TABLE games_city
(
    games_id INTEGER default NULL,
    city_id  INTEGER default NULL,
    foreign key (city_id) references city(id),
    foreign key (games_id) references games(id)
)

CREATE TABLE medal
(
    id         INTEGER not null
            primary key,
    medal_name TEXT default NULL
)

CREATE TABLE noc_region
(
    id          INTEGER not null
            primary key,
    noc         TEXT   default NULL,
    region_name TEXT default NULL
)

CREATE TABLE person
(
    id        INTEGER not null
        primary key,
    full_name TEXT default NULL,
    gender    TEXT  default NULL,
    height    INTEGER          default NULL,
    weight    INTEGER          default NULL
)

CREATE TABLE games_competitor
(
    id        INTEGER not null
            primary key,
    games_id  INTEGER default NULL,
    person_id INTEGER default NULL,
    age       INTEGER default NULL,
    foreign key (games_id) references games(id),
    foreign key (person_id) references person(id)
)

CREATE TABLE person_region
(
    person_id INTEGER default NULL,
    region_id INTEGER default NULL,
    foreign key (person_id) references person(id),
    foreign key (region_id) references noc_region(id)
)

CREATE TABLE sport
(
    id         INTEGER not null
            primary key,
    sport_name TEXT default NULL
)

CREATE TABLE event
(
    id         INTEGER not null
            primary key,
    sport_id   INTEGER          default NULL,
    event_name TEXT default NULL,
    foreign key (sport_id) references sport(id)
)

CREATE TABLE competitor_event
(
    event_id      INTEGER default NULL,
    competitor_id INTEGER default NULL,
    medal_id      INTEGER default NULL,
    foreign key (competitor_id) references games_competitor(id),
    foreign key (event_id) references event(id),
    foreign key (medal_id) references medal(id)
)

/* Answer the following: Please list the names of all the Olympic competitors from Finland. names of competitors refer to full_name; from Finland refers to region_name = 'Finland'; */
SELECT 
SELECT T3.full_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 T1.region_name = 'Finland'
/* Given the following database schema: */
CREATE TABLE city
(
    id        INTEGER not null
            primary key,
    city_name TEXT default NULL
)

CREATE TABLE games
(
    id         INTEGER not null
            primary key,
    games_year INTEGER          default NULL,
    games_name TEXT default NULL,
    season     TEXT default NULL
)

CREATE TABLE games_city
(
    games_id INTEGER default NULL,
    city_id  INTEGER default NULL,
    foreign key (city_id) references city(id),
    foreign key (games_id) references games(id)
)

CREATE TABLE medal
(
    id         INTEGER not null
            primary key,
    medal_name TEXT default NULL
)

CREATE TABLE noc_region
(
    id          INTEGER not null
            primary key,
    noc         TEXT   default NULL,
    region_name TEXT default NULL
)

CREATE TABLE person
(
    id        INTEGER not null
        primary key,
    full_name TEXT default NULL,
    gender    TEXT  default NULL,
    height    INTEGER          default NULL,
    weight    INTEGER          default NULL
)

CREATE TABLE games_competitor
(
    id        INTEGER not null
            primary key,
    games_id  INTEGER default NULL,
    person_id INTEGER default NULL,
    age       INTEGER default NULL,
    foreign key (games_id) references games(id),
    foreign key (person_id) references person(id)
)

CREATE TABLE person_region
(
    person_id INTEGER default NULL,
    region_id INTEGER default NULL,
    foreign key (person_id) references person(id),
    foreign key (region_id) references noc_region(id)
)

CREATE TABLE sport
(
    id         INTEGER not null
            primary key,
    sport_name TEXT default NULL
)

CREATE TABLE event
(
    id         INTEGER not null
            primary key,
    sport_id   INTEGER          default NULL,
    event_name TEXT default NULL,
    foreign key (sport_id) references sport(id)
)

CREATE TABLE competitor_event
(
    event_id      INTEGER default NULL,
    competitor_id INTEGER default NULL,
    medal_id      INTEGER default NULL,
    foreign key (competitor_id) references games_competitor(id),
    foreign key (event_id) references event(id),
    foreign key (medal_id) references medal(id)
)

/* Answer the following: The Olympic competitor John Aalberg is from which region? from which region refers to region_name; */
SELECT 
SELECT 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.full_name = 'John Aalberg'
/* Given the following database schema: */
CREATE TABLE city
(
    id        INTEGER not null
            primary key,
    city_name TEXT default NULL
)

CREATE TABLE games
(
    id         INTEGER not null
            primary key,
    games_year INTEGER          default NULL,
    games_name TEXT default NULL,
    season     TEXT default NULL
)

CREATE TABLE games_city
(
    games_id INTEGER default NULL,
    city_id  INTEGER default NULL,
    foreign key (city_id) references city(id),
    foreign key (games_id) references games(id)
)

CREATE TABLE medal
(
    id         INTEGER not null
            primary key,
    medal_name TEXT default NULL
)

CREATE TABLE noc_region
(
    id          INTEGER not null
            primary key,
    noc         TEXT   default NULL,
    region_name TEXT default NULL
)

CREATE TABLE person
(
    id        INTEGER not null
        primary key,
    full_name TEXT default NULL,
    gender    TEXT  default NULL,
    height    INTEGER          default NULL,
    weight    INTEGER          default NULL
)

CREATE TABLE games_competitor
(
    id        INTEGER not null
            primary key,
    games_id  INTEGER default NULL,
    person_id INTEGER default NULL,
    age       INTEGER default NULL,
    foreign key (games_id) references games(id),
    foreign key (person_id) references person(id)
)

CREATE TABLE person_region
(
    person_id INTEGER default NULL,
    region_id INTEGER default NULL,
    foreign key (person_id) references person(id),
    foreign key (region_id) references noc_region(id)
)

CREATE TABLE sport
(
    id         INTEGER not null
            primary key,
    sport_name TEXT default NULL
)

CREATE TABLE event
(
    id         INTEGER not null
            primary key,
    sport_id   INTEGER          default NULL,
    event_name TEXT default NULL,
    foreign key (sport_id) references sport(id)
)

CREATE TABLE competitor_event
(
    event_id      INTEGER default NULL,
    competitor_id INTEGER default NULL,
    medal_id      INTEGER default NULL,
    foreign key (competitor_id) references games_competitor(id),
    foreign key (event_id) references event(id),
    foreign key (medal_id) references medal(id)
)

/* Answer the following: What is the NOC code of the region where the tallest male Olympic competitor is from? NOC code of the region refers to noc; male refers to gender = 'M'; the tallest refers to MAX(height); */
SELECT 
SELECT T1.noc 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' ORDER BY T3.height DESC LIMIT 1
/* Given the following database schema: */
CREATE TABLE city
(
    id        INTEGER not null
            primary key,
    city_name TEXT default NULL
)

CREATE TABLE games
(
    id         INTEGER not null
            primary key,
    games_year INTEGER          default NULL,
    games_name TEXT default NULL,
    season     TEXT default NULL
)

CREATE TABLE games_city
(
    games_id INTEGER default NULL,
    city_id  INTEGER default NULL,
    foreign key (city_id) references city(id),
    foreign key (games_id) references games(id)
)

CREATE TABLE medal
(
    id         INTEGER not null
            primary key,
    medal_name TEXT default NULL
)

CREATE TABLE noc_region
(
    id          INTEGER not null
            primary key,
    noc         TEXT   default NULL,
    region_name TEXT default NULL
)

CREATE TABLE person
(
    id        INTEGER not null
        primary key,
    full_name TEXT default NULL,
    gender    TEXT  default NULL,
    height    INTEGER          default NULL,
    weight    INTEGER          default NULL
)

CREATE TABLE games_competitor
(
    id        INTEGER not null
            primary key,
    games_id  INTEGER default NULL,
    person_id INTEGER default NULL,
    age       INTEGER default NULL,
    foreign key (games_id) references games(id),
    foreign key (person_id) references person(id)
)

CREATE TABLE person_region
(
    person_id INTEGER default NULL,
    region_id INTEGER default NULL,
    foreign key (person_id) references person(id),
    foreign key (region_id) references noc_region(id)
)

CREATE TABLE sport
(
    id         INTEGER not null
            primary key,
    sport_name TEXT default NULL
)

CREATE TABLE event
(
    id         INTEGER not null
            primary key,
    sport_id   INTEGER          default NULL,
    event_name TEXT default NULL,
    foreign key (sport_id) references sport(id)
)

CREATE TABLE competitor_event
(
    event_id      INTEGER default NULL,
    competitor_id INTEGER default NULL,
    medal_id      INTEGER default NULL,
    foreign key (competitor_id) references games_competitor(id),
    foreign key (event_id) references event(id),
    foreign key (medal_id) references medal(id)
)

/* Answer the following: Among all the Olympic competitors from Finland, how many of them are female? competitors from Finland refer to id where region_name = 'Finland'; female refers to gender = 'F'; */
SELECT 
SELECT COUNT(T3.id) 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 T1.region_name = 'Finland' AND T3.gender = 'F'
/* Given the following database schema: */
CREATE TABLE city
(
    id        INTEGER not null
            primary key,
    city_name TEXT default NULL
)

CREATE TABLE games
(
    id         INTEGER not null
            primary key,
    games_year INTEGER          default NULL,
    games_name TEXT default NULL,
    season     TEXT default NULL
)

CREATE TABLE games_city
(
    games_id INTEGER default NULL,
    city_id  INTEGER default NULL,
    foreign key (city_id) references city(id),
    foreign key (games_id) references games(id)
)

CREATE TABLE medal
(
    id         INTEGER not null
            primary key,
    medal_name TEXT default NULL
)

CREATE TABLE noc_region
(
    id          INTEGER not null
            primary key,
    noc         TEXT   default NULL,
    region_name TEXT default NULL
)

CREATE TABLE person
(
    id        INTEGER not null
        primary key,
    full_name TEXT default NULL,
    gender    TEXT  default NULL,
    height    INTEGER          default NULL,
    weight    INTEGER          default NULL
)

CREATE TABLE games_competitor
(
    id        INTEGER not null
            primary key,
    games_id  INTEGER default NULL,
    person_id INTEGER default NULL,
    age       INTEGER default NULL,
    foreign key (games_id) references games(id),
    foreign key (person_id) references person(id)
)

CREATE TABLE person_region
(
    person_id INTEGER default NULL,
    region_id INTEGER default NULL,
    foreign key (person_id) references person(id),
    foreign key (region_id) references noc_region(id)
)

CREATE TABLE sport
(
    id         INTEGER not null
            primary key,
    sport_name TEXT default NULL
)

CREATE TABLE event
(
    id         INTEGER not null
            primary key,
    sport_id   INTEGER          default NULL,
    event_name TEXT default NULL,
    foreign key (sport_id) references sport(id)
)

CREATE TABLE competitor_event
(
    event_id      INTEGER default NULL,
    competitor_id INTEGER default NULL,
    medal_id      INTEGER default NULL,
    foreign key (competitor_id) references games_competitor(id),
    foreign key (event_id) references event(id),
    foreign key (medal_id) references medal(id)
)

/* Answer the following: In which city was the 1992 Summer Olympic Games held? In which city refers to city_name; 1992 Summer Olympic Games refer to games_name = '1992 Summer'; */
SELECT 
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_name = '1992 Summer'