1sf/bird-sql-train-with-schema huggingface dataset:
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Please list the directions in which the trains with 4 short cars run.
Evidence: short refers to len = 'short'; 4 cars run refers to position = 4
SQL: SELECT T2.direction FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.len = 'short' AND T1.position = 4
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: What is the average number of cars on trains that run in the east direction?
Evidence: calculation = DIVIDE(count(id), count(train_id))
SQL: SELECT CAST(COUNT(T1.id) AS REAL) / COUNT(DISTINCT T1.train_id) FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T2.direction = 'east'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Among the trains that have at least one non-regular shaped car, what is the percentage of it running in the east direction?
Evidence: non-regular shaped car refers to shape in ('bucket', 'ellipse'); calculation = MULTIPLY(DIVIDE(count(direction = 'east' then train_id)), count(train_id), 100)
SQL: SELECT CAST(COUNT(DISTINCT CASE WHEN T2.direction = 'east' THEN T1.train_id ELSE NULL END) AS REAL) * 100 / COUNT(DISTINCT T1.train_id) FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.shape IN ('bucket', 'ellipse')
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: How many short cars are in the shape of hexagon?
Evidence: short cars refers to len = 'short'; in the shape of hexagon refers to shape = 'hexagon'
SQL: SELECT COUNT(id) FROM cars WHERE shape = 'hexagon' AND len = 'short'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: How many trains are running west?
Evidence: west is a direction
SQL: SELECT COUNT(id) FROM trains WHERE direction = 'west'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: What are the load shapes of all the short ellipse cars?
Evidence: short refers to len = 'short'; ellipse cars refers to shape = 'ellipse'
SQL: SELECT load_shape FROM cars WHERE shape = 'ellipse' AND len = 'short'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: What are the ids of the train running east?
Evidence: east is a direction
SQL: SELECT id FROM trains WHERE direction = 'east'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: How many wheels do the long cars have?
Evidence: long cars refers to len = 'long'
SQL: SELECT SUM(wheels) FROM cars WHERE len = 'long'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Which direction do the majority of the trains are running?
Evidence: majority of train refers to MAX(count(id))
SQL: SELECT direction FROM trains GROUP BY direction ORDER BY COUNT(id) DESC
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Among the trains running east, how many trains have at least 4 cars?
Evidence: east is a direction; at least 4 cars refers to carsNum > = 4
SQL: SELECT SUM(CASE WHEN T1.direction = 'east' THEN 1 ELSE 0 END)as count FROM trains AS T1 INNER JOIN ( SELECT train_id, COUNT(id) AS carsNum FROM cars GROUP BY train_id ) AS T2 ON T1.id = T2.train_id WHERE T2.carsNum >= 4
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Which direction do most of the trains with rectangle-shaped second cars run?
Evidence: most of the trains refers to MAX(count(id)); second cars refers to position = 2
SQL: SELECT T2.direction FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.position = 2 AND T1.shape = 'rectangle' GROUP BY T2.direction ORDER BY COUNT(T2.id) DESC LIMIT 1
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: How many trains running west have double sided cars in 3rd position?
Evidence: west is a direction; double sided cars refers to sides = 'double'; 3rd position refers to position = 3
SQL: SELECT COUNT(T.train_id) FROM (SELECT T1.train_id FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.position = 3 AND T2.direction = 'west' AND T1.sides = 'double' GROUP BY T1.train_id)as T
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: How many eastbound trains have rectangular-shaped head cars?
Evidence: eastbound refers to direction = 'east'; head cars refers to position = 1
SQL: SELECT COUNT(T.train_id) FROM (SELECT T1.train_id FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.position = 1 AND T2.direction = 'east' AND T1.shape = 'rectangle' GROUP BY T1.train_id)as T
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Among the trains running west, how many trains have no more than one car with an open roof?
Evidence: running west refers to direction = 'west'; open roof refers to roof = 'none'
SQL: SELECT SUM(CASE WHEN T1.direction = 'west' THEN 1 ELSE 0 END)as count FROM trains AS T1 INNER JOIN ( SELECT train_id, COUNT(id) FROM cars WHERE roof = 'none' GROUP BY train_id HAVING COUNT(id) = 1 ) AS T2 ON T1.id = T2.train_id
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Which direction does the majority of the trains that have 3 cars are running?
Evidence: 3 cars refers to carsNum = 3
SQL: SELECT T1.direction FROM trains AS T1 INNER JOIN ( SELECT train_id, COUNT(id) AS carsNum FROM cars GROUP BY train_id HAVING carsNum = 3 ) AS T2 ON T1.id = T2.train_id GROUP BY T1.direction
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: How many trains with fully loaded head cars are running east?
Evidence: fully loaded refers to load_num = 3; head cars refers to position = 1
SQL: SELECT COUNT(DISTINCT T1.train_id) FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.position = 1 AND T1.load_num = 3
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: How many cars running east have double-sided tail cars?
Evidence: east is an direction; double-sided refers to sides = 'double'; tail refers to carsposition = trailPosi
SQL: SELECT COUNT(T1.id) FROM trains AS T1 INNER JOIN cars AS T2 ON T1.id = T2.train_id INNER JOIN ( SELECT train_id, MAX(position) AS trailPosi FROM cars GROUP BY train_id ) AS T3 ON T1.id = T3.train_id WHERE T1.direction = 'east' AND T2.position = T3.trailPosi AND T2.sides = 'double'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: List all the directions of the trains that have empty cars.
Evidence: empty cars refers to load_num = 0
SQL: SELECT T2.direction FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.load_num = 0
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: What is the direction of the train with a diamond-shaped load in its 2nd car?
Evidence: 2nd car refers to position = 2
SQL: SELECT T2.direction FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.position = 2 AND T1.shape = 'diamond'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Among the trains running west, how many trains have three-wheeled, jagged roof cars?
Evidence: west is an direction; three-wheeled refers to wheels = 3; jagged roof refers to roof = 'jagged'
SQL: SELECT SUM(CASE WHEN T2.direction = 'west' THEN 1 ELSE 0 END)as count FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.wheels = 3 AND T1.roof = 'jagged'
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: Provide the directions for all the trains that have 2 or less cars.
Evidence: 2 or less cars refers to trailPosi < = 2
SQL: SELECT T1.direction FROM trains AS T1 INNER JOIN ( SELECT train_id, MAX(position) AS trailPosi FROM cars GROUP BY train_id ) AS T2 ON T1.id = T2.train_id WHERE T2.trailPosi <= 2
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: What is the percentage of all the trains with at least 4 cars? List the directions of the said trains.
Evidence: at least 4 cars refers to trailPosi > = 4; calculation = MULTIPLY(DIVIDE(count(trailPosi > = 4 then id), count(id)), 100)
SQL: SELECT CAST(COUNT(CASE WHEN T2.trailPosi >= 4 THEN T1.id ELSE NULL END) AS REAL) * 100 / COUNT(T1.id) FROM trains AS T1 INNER JOIN ( SELECT train_id, MAX(position) AS trailPosi FROM cars GROUP BY train_id ) AS T2 ON T1.id = T2.train_id UNION ALL SELECT T1.direction FROM trains AS T1 INNER JOIN ( SELECT train_id, MAX(position) AS trailPosi FROM cars t GROUP BY train_id ) AS T2 ON T1.id = T2.train_id AND T2.trailPosi >= 4
Database: trains
Tables: cars, trains
Columns (table index, column name): -1, *, 0, id, 0, train_id, 0, position, 0, shape, 0, len, 0, sides, 0, roof, 0, wheels, 0, load_shape, 0, load_num, 1, id, 1, direction
Question: List all the load shapes of all head cars of each train and identify which load shape has the highest number. Calculate the percentage of the trains with the said head car that are running eas
Evidence: which load shape has the highest number refers to MAX(load_shape); head car refers to position = 1; east is a direction; calculation = MULTIPLY(DIVIDE(count(direction = 'east' where MAX(load_shape) where position = 1 then id), count(id)), 100)
SQL: SELECT DISTINCT T3.load_shape FROM ( SELECT load_shape, train_id FROM cars WHERE position = 1 ORDER BY train_id DESC ) AS T3 UNION ALL SELECT T4.load_shape FROM ( SELECT load_shape, train_id FROM cars WHERE position = 1 ORDER BY train_id DESC LIMIT 1 ) AS T4 UNION ALL SELECT (CAST(COUNT(DISTINCT CASE WHEN T2.direction = 'east' THEN T2.id ELSE NULL END) AS REAL) * 100 / COUNT(DISTINCT T2.id)) FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.position = 1 AND T1.load_shape = ( SELECT T4.load_shape FROM ( SELECT load_shape, train_id FROM cars AS T WHERE position = 1 ORDER BY train_id DESC LIMIT 1 ) AS T4 )
Database: movie
Tables: actor, movie, characters
Columns (table index, column name): -1, *, 0, ActorID, 0, Name, 0, Date of Birth, 0, Birth City, 0, Birth Country, 0, Height (Inches), 0, Biography, 0, Gender, 0, Ethnicity, 0, NetWorth, 1, MovieID, 1, Title, 1, MPAA Rating, 1, Budget, 1, Gross, 1, Release Date, 1, Genre, 1, Runtime, 1, Rating, 1, Rating Count, 1, Summary, 2, MovieID, 2, ActorID, 2, Character Name, 2, creditOrder, 2, pay, 2, screentime
Question: Please list the names of the characters in the movie Look Who's Talking.
Evidence: movie Look Who's Talking refers to title = 'Look Who's Talking'
SQL: SELECT T2.`Character Name` FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T1.Title = 'Look Who''s Talking'
Database: movie
Tables: actor, movie, characters
Columns (table index, column name): -1, *, 0, ActorID, 0, Name, 0, Date of Birth, 0, Birth City, 0, Birth Country, 0, Height (Inches), 0, Biography, 0, Gender, 0, Ethnicity, 0, NetWorth, 1, MovieID, 1, Title, 1, MPAA Rating, 1, Budget, 1, Gross, 1, Release Date, 1, Genre, 1, Runtime, 1, Rating, 1, Rating Count, 1, Summary, 2, MovieID, 2, ActorID, 2, Character Name, 2, creditOrder, 2, pay, 2, screentime
Question: Which character has the longest screen time in the movie Batman?
Evidence: longest screen time refers to max(screentime); movie Batman refers to title = 'Batman'
SQL: SELECT T2.`Character Name` FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T1.Title = 'Batman' ORDER BY T2.screentime DESC LIMIT 1
Database: movie
Tables: actor, movie, characters
Columns (table index, column name): -1, *, 0, ActorID, 0, Name, 0, Date of Birth, 0, Birth City, 0, Birth Country, 0, Height (Inches), 0, Biography, 0, Gender, 0, Ethnicity, 0, NetWorth, 1, MovieID, 1, Title, 1, MPAA Rating, 1, Budget, 1, Gross, 1, Release Date, 1, Genre, 1, Runtime, 1, Rating, 1, Rating Count, 1, Summary, 2, MovieID, 2, ActorID, 2, Character Name, 2, creditOrder, 2, pay, 2, screentime
Question: Which actor played the role of Joker in the movie Batman?
Evidence: role of Joker refers to character_name = 'Joker'; movie Batman refers to title = 'Batman'
SQL: SELECT T3.Name FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T1.Title = 'Batman' AND T2.`Character Name` = 'Joker'
Database: movie
Tables: actor, movie, characters
Columns (table index, column name): -1, *, 0, ActorID, 0, Name, 0, Date of Birth, 0, Birth City, 0, Birth Country, 0, Height (Inches), 0, Biography, 0, Gender, 0, Ethnicity, 0, NetWorth, 1, MovieID, 1, Title, 1, MPAA Rating, 1, Budget, 1, Gross, 1, Release Date, 1, Genre, 1, Runtime, 1, Rating, 1, Rating Count, 1, Summary, 2, MovieID, 2, ActorID, 2, Character Name, 2, creditOrder, 2, pay, 2, screentime
Question: Please list the names of the actors who played a role in the movie Batman.
Evidence: movie Batman refers to title = 'Batman'
SQL: SELECT T3.Name FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T1.Title = 'Batman'
Database: movie
Tables: actor, movie, characters
Columns (table index, column name): -1, *, 0, ActorID, 0, Name, 0, Date of Birth, 0, Birth City, 0, Birth Country, 0, Height (Inches), 0, Biography, 0, Gender, 0, Ethnicity, 0, NetWorth, 1, MovieID, 1, Title, 1, MPAA Rating, 1, Budget, 1, Gross, 1, Release Date, 1, Genre, 1, Runtime, 1, Rating, 1, Rating Count, 1, Summary, 2, MovieID, 2, ActorID, 2, Character Name, 2, creditOrder, 2, pay, 2, screentime
Question: Which movie is the character Dr. Archibald 'Moonlight' Graham from?
Evidence: movie name refers to title; character Dr. Archibald 'Moonlight' Graham refers to character_name = 'Dr. Archibald 'Moonlight' Graham'
SQL: SELECT T1.Title FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T2.`Character Name` = 'Dr. Archibald ''Moonlight'' Graham'
Database: movie
Tables: actor, movie, characters
Columns (table index, column name): -1, *, 0, ActorID, 0, Name, 0, Date of Birth, 0, Birth City, 0, Birth Country, 0, Height (Inches), 0, Biography, 0, Gender, 0, Ethnicity, 0, NetWorth, 1, MovieID, 1, Title, 1, MPAA Rating, 1, Budget, 1, Gross, 1, Release Date, 1, Genre, 1, Runtime, 1, Rating, 1, Rating Count, 1, Summary, 2, MovieID, 2, ActorID, 2, Character Name, 2, creditOrder, 2, pay, 2, screentime
Question: Please list the names of the movies starring Tom Cruise.
Evidence: movie name refers to title; starring Tom Cruise refers to name = 'Tom Cruise'
SQL: SELECT T1.Title FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T3.Name = 'Tom Cruise'
Database: movie
Tables: actor, movie, characters
Columns (table index, column name): -1, *, 0, ActorID, 0, Name, 0, Date of Birth, 0, Birth City, 0, Birth Country, 0, Height (Inches), 0, Biography, 0, Gender, 0, Ethnicity, 0, NetWorth, 1, MovieID, 1, Title, 1, MPAA Rating, 1, Budget, 1, Gross, 1, Release Date, 1, Genre, 1, Runtime, 1, Rating, 1, Rating Count, 1, Summary, 2, MovieID, 2, ActorID, 2, Character Name, 2, creditOrder, 2, pay, 2, screentime
Question: How many movies starring Morgan Freeman are suggested by parental guidance?
Evidence: 'suggested by parental guidance' refers to mpaa_rating = 'PG'
SQL: SELECT COUNT(*) FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T3.Name = 'Morgan Freeman' AND T1.`MPAA Rating` = 'PG'
Database: movie
Tables: actor, movie, characters
Columns (table index, column name): -1, *, 0, ActorID, 0, Name, 0, Date of Birth, 0, Birth City, 0, Birth Country, 0, Height (Inches), 0, Biography, 0, Gender, 0, Ethnicity, 0, NetWorth, 1, MovieID, 1, Title, 1, MPAA Rating, 1, Budget, 1, Gross, 1, Release Date, 1, Genre, 1, Runtime, 1, Rating, 1, Rating Count, 1, Summary, 2, MovieID, 2, ActorID, 2, Character Name, 2, creditOrder, 2, pay, 2, screentime
Question: Among the movies starring Tom Cruise, which one of them has the best quality?
Evidence: starring Tom Cruise refers to name = 'Tom Cruise'; best quality refers to max(rating)
SQL: SELECT T1.Title FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T3.Name = 'Tom Cruise' ORDER BY T1.Rating DESC LIMIT 1
Database: movie
Tables: actor, movie, characters
Columns (table index, column name): -1, *, 0, ActorID, 0, Name, 0, Date of Birth, 0, Birth City, 0, Birth Country, 0, Height (Inches), 0, Biography, 0, Gender, 0, Ethnicity, 0, NetWorth, 1, MovieID, 1, Title, 1, MPAA Rating, 1, Budget, 1, Gross, 1, Release Date, 1, Genre, 1, Runtime, 1, Rating, 1, Rating Count, 1, Summary, 2, MovieID, 2, ActorID, 2, Character Name, 2, creditOrder, 2, pay, 2, screentime
Question: What is the name of the character played by Tom Cruise in the movie Born on the Fourth of July?
Evidence: played by Tom Cruise refers to name = 'Tom Cruise'; movie Born on the Fourth of July refers to title = 'Born on the Fourth of July'
SQL: SELECT T2.`Character Name` FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T3.Name = 'Tom Cruise' AND T1.Title = 'Born on the Fourth of July'
Database: movie
Tables: actor, movie, characters
Columns (table index, column name): -1, *, 0, ActorID, 0, Name, 0, Date of Birth, 0, Birth City, 0, Birth Country, 0, Height (Inches), 0, Biography, 0, Gender, 0, Ethnicity, 0, NetWorth, 1, MovieID, 1, Title, 1, MPAA Rating, 1, Budget, 1, Gross, 1, Release Date, 1, Genre, 1, Runtime, 1, Rating, 1, Rating Count, 1, Summary, 2, MovieID, 2, ActorID, 2, Character Name, 2, creditOrder, 2, pay, 2, screentime
Question: Please list the names of all the characters played by Tom Cruise.
Evidence: played by Tom Cruise refers to name = 'Tom Cruise'
SQL: SELECT T1.`Character Name` FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE T2.Name = 'Tom Cruise'
Database: movie
Tables: actor, movie, characters
Columns (table index, column name): -1, *, 0, ActorID, 0, Name, 0, Date of Birth, 0, Birth City, 0, Birth Country, 0, Height (Inches), 0, Biography, 0, Gender, 0, Ethnicity, 0, NetWorth, 1, MovieID, 1, Title, 1, MPAA Rating, 1, Budget, 1, Gross, 1, Release Date, 1, Genre, 1, Runtime, 1, Rating, 1, Rating Count, 1, Summary, 2, MovieID, 2, ActorID, 2, Character Name, 2, creditOrder, 2, pay, 2, screentime
Question: Among the actors who starred in the movie Batman, which one of them is the tallest?
Evidence: movie Batman refers to title = 'Batman'; tallest refers to max(height_inches)
SQL: SELECT T3.Name FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T1.Title = 'Batman' ORDER BY T3.`Height (Inches)` DESC LIMIT 1
Database: movie
Tables: actor, movie, characters
Columns (table index, column name): -1, *, 0, ActorID, 0, Name, 0, Date of Birth, 0, Birth City, 0, Birth Country, 0, Height (Inches), 0, Biography, 0, Gender, 0, Ethnicity, 0, NetWorth, 1, MovieID, 1, Title, 1, MPAA Rating, 1, Budget, 1, Gross, 1, Release Date, 1, Genre, 1, Runtime, 1, Rating, 1, Rating Count, 1, Summary, 2, MovieID, 2, ActorID, 2, Character Name, 2, creditOrder, 2, pay, 2, screentime
Question: How many movies star a male African American actor?
Evidence: male refers to gender = 'Male'; African American refers to ethnicity = 'African American'
SQL: SELECT COUNT(*) FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE T2.Gender = 'Male' AND T2.Ethnicity = 'African American'
Database: movie
Tables: actor, movie, characters
Columns (table index, column name): -1, *, 0, ActorID, 0, Name, 0, Date of Birth, 0, Birth City, 0, Birth Country, 0, Height (Inches), 0, Biography, 0, Gender, 0, Ethnicity, 0, NetWorth, 1, MovieID, 1, Title, 1, MPAA Rating, 1, Budget, 1, Gross, 1, Release Date, 1, Genre, 1, Runtime, 1, Rating, 1, Rating Count, 1, Summary, 2, MovieID, 2, ActorID, 2, Character Name, 2, creditOrder, 2, pay, 2, screentime
Question: What is the average rating of all the movies starring Tom Cruise?
Evidence: starring Tom Cruise refers to name = 'Tom Cruise'; average rating = divide(sum(rating where name = 'Tom Cruise'), count(movieid where name = 'Tom Cruise'))
SQL: SELECT AVG(T1.Rating) FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T3.Name = 'Tom Cruise'