Chinastark/bird_dataset huggingface dataset:
Database: shakespeare
Note: act number 5 refers to act = 5; Titus Andronicus refers to title = 'Titus Andronicus'; percentage = divide(sum(act = 5), count(act)) as percentage;
Question: What is the percentage of act number 5 in Titus Andronicus?
SQL: SELECT cast(sum(iif(chapters.act = 5, 1, 0)) AS REAL) * 100 / count(chapters.act) FROM works INNER JOIN chapters ON works.id = chapters.work_id WHERE works.title = 'Titus Andronicus'
Database: shakespeare
Note: Tragedy refers to genretype = 'Tragedy';
Question: How many of the works of Shakespeare are Tragedy?
SQL: SELECT count(id) FROM works WHERE genretype = 'Tragedy'
Database: shakespeare
Note: works refers to title; have the word "Henry" on its title refers to title = '%Henry%';
Question: Among the works of Shakespeare, how many of them have the word "Henry" on its title?
SQL: SELECT count(id) FROM works WHERE title LIKE '%Henry%'
Database: shakespeare
Note: "O my poor brother! and so perchance may he be." refers to  plaintext = 'O my poor brother! and so perchance may he be.';
Question: Give the character's ID of the character that said the paragraph "O my poor brother! and so perchance may he be."
SQL: SELECT character_id FROM paragraphs WHERE plaintext = 'O my poor brother! and so perchance may he be.'
Database: shakespeare
Note: paragraph number refers to paragraphnum; character named "Sir Andrew Aguecheek" refers to charname = 'Sir Andrew Aguecheek';
Question: List the paragraph number and paragraphs said by the character named "Sir Andrew Aguecheek".
SQL: SELECT paragraphs.paragraphnum, paragraphs.id FROM characters INNER JOIN paragraphs ON characters.id = paragraphs.character_id WHERE characters.charname = 'Sir Andrew Aguecheek'
Database: shakespeare
Note: characters name refers to charname; most recent work refers to max(date);
Question: Give the title and the characters name of the most recent work of Shakespeare.
SQL: SELECT works.title, characters.charname FROM works INNER JOIN chapters ON works.id = chapters.work_id INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id INNER JOIN characters ON paragraphs.character_id = characters.id ORDER BY works.date DESC LIMIT 1
Database: shakespeare
Note: paragraph number between 1900 to 1950 refers to paragraphnum >= 1500 AND paragraphnum <= 1950; texts refers to plaintext; a character described as a sea captain, friend to Sebatian refers to characters.description = 'a sea captain, friend to Sebastian';
Question: Among paragraphs with paragraph number between 1900 to 1950, list the texts said by a character described as a sea captain, friend to Sebatian.
SQL: SELECT characters.description FROM characters INNER JOIN paragraphs ON characters.id = paragraphs.character_id WHERE paragraphs.plaintext = 'a sea captain, friend to Sebastian' AND paragraphs.paragraphnum BETWEEN 1500 AND 1950
Database: shakespeare
Note: described as "Mytilene. A street before the brothel." refers to chapters.description = 'Mytilene. A street before the brothel.';
Question: What is the long title of the Shakespeare's work with Act 4 Scene 5 described as "Mytilene. A street before the brothel."?
SQL: SELECT works.longtitle FROM works RIGHT JOIN chapters ON works.id = chapters.work_id WHERE chapters.description = 'Mytilene. A street before the brothel.'
Database: shakespeare
Note: character refers to charname; "This is Illyria, lady." refers to plaintext = 'This is Illyria, lady.';
Question: Who is the character that said "This is Illyria, lady."?
SQL: SELECT characters.charname FROM characters INNER JOIN paragraphs ON characters.id = paragraphs.character_id WHERE paragraphs.plaintext = 'This is Illyria, lady.'
Database: shakespeare
Note: between 1600 to 1610 refers to date >= 1600 AND date <= 1610; "Third Servingman" refers to charname = 'Third Servingman';
Question: In Shakespeare's works between 1600 to 1610, how many of these have a character as a "Third Servingman"?
SQL: SELECT count(DISTINCT chapters.work_id) FROM works INNER JOIN chapters ON works.id = chapters.work_id INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id INNER JOIN characters ON paragraphs.character_id = characters.id WHERE works.date BETWEEN 1600 AND 1610 AND characters.charname = 'Third Servingman'
Database: shakespeare
Note: Venus and Adonis refers to title = 'Venus and Adonis'; last scene refers to max(scene);
Question: In the Venus and Adonis, what is the description of the last scene listed?
SQL: SELECT chapters.description FROM works RIGHT JOIN chapters ON works.id = chapters.work_id WHERE works.title = 'Venus and Adonis' ORDER BY chapters.scene DESC LIMIT 1
Database: shakespeare
Note: Twelfth Night refers to title = 'Twelfth Night'; total number of lines said by Viola refers to count(character_id) where charname = 'Viola';
Question: In Act 1 Scene 2 of the Twelfth Night, what is the total number of of lines said by Viola?
SQL: SELECT count(characters.id) FROM works INNER JOIN chapters ON works.id = chapters.work_id INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id INNER JOIN characters ON paragraphs.character_id = characters.id WHERE chapters.act = 1 AND chapters.scene = 2 AND characters.id = 1238 AND characters.charname = 'Viola' AND works.title = 'Twelfth Night'
Database: shakespeare
Note: character refers to chapter_id; text "Fear not thou, man, thou shalt lose nothing here."  refers to plaintext = 'Fear not thou, man, thou shalt lose nothing here.';
Question: What is the character and work ID of the text "Fear not thou, man, thou shalt lose nothing here."?
SQL: SELECT paragraphs.character_id, chapters.work_id FROM chapters INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id WHERE paragraphs.plaintext = 'Fear not thou, man, thou shalt lose nothing here.'
Database: shakespeare
Note: paragraph "What, wilt thou hear some music, my sweet love?" refers to  plaintext = 'What, wilt thou hear some music, my sweet love?';
Question: What is the chapter description where the paragraph "What, wilt thou hear some music, my sweet love?" belongs?
SQL: SELECT chapters.id, chapters.description FROM chapters INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id WHERE paragraphs.plaintext = 'What, wilt thou hear some music, my sweet love?'
Database: shakespeare
Note: scene numbers refers to scene; character named Sir Toby Belch refers to charname = 'Sir Toby Belch'; in the Twelfth Night refers to title = 'Twelfth Night';
Question: List the scene numbers involving the character named Sir Toby Belch in the Twelfth Night.
SQL: SELECT DISTINCT chapters.scene FROM works INNER JOIN chapters ON works.id = chapters.work_id INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id INNER JOIN characters ON paragraphs.character_id = characters.id WHERE works.title = 'Twelfth Night' AND characters.charname = 'Sir Toby Belch'
Database: shakespeare
Note: works before 1600 refers to date < 1600; tragic story refers to genretype = 'Tragedy'; character named "Tybalt" refers to charname = 'Tybalt';
Question: In Shakespeare's works before 1600, list down the title of the tragic story he had written that involved a character named "Tybalt".
SQL: SELECT DISTINCT works.title FROM works INNER JOIN chapters ON works.id = chapters.work_id INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id INNER JOIN characters ON paragraphs.character_id = characters.id WHERE works.date < 1600 AND works.genretype = 'Tragedy' AND characters.charname = 'Tybalt'
Database: shakespeare
Note: a year greater than the 89% of average year refers to date > multiply(divide(SUM(date) , COUNT(date)), 0.89);
Question: List the chapter ID of the works with a year greater than the 89% of average year of all listed works of Shakespeare.
SQL: SELECT chapters.id FROM works INNER JOIN chapters ON works.id = chapters.work_id WHERE works.date > ( SELECT avg(DATE) FROM works ) * 0.89
Database: shakespeare
Note: comedy works refers to genretype = 'Comedy'; a character named "antonio" refers to charname = 'antonio'; percentage = divide(sum(charname = 'Antonio'), count(charname)) as percentage;
Question: Among the comedy works of Shakespeare, what is the percentage of his works with a character named "antonio"?
SQL: SELECT cast(sum(iif(characters.charname = 'antonio', 1, 0)) AS REAL) * 100 / count(works.id) FROM works INNER JOIN chapters ON works.id = chapters.work_id INNER JOIN paragraphs ON chapters.id = paragraphs.chapter_id INNER JOIN characters ON paragraphs.character_id = characters.id WHERE works.genretype = 'Comedy'
Database: cars
Note: with 8 cylinders refers to cylinders = 8; name of the car refers to car_name; the most expensive refers to max(price);
Question: Among the cars with 8 cylinders, what is the name of the one that's the most expensive?
SQL: SELECT DATA.car_name FROM DATA INNER JOIN price ON DATA.id = price.id WHERE DATA.cylinders = 8 ORDER BY price.price DESC LIMIT 1
Database: cars
Note: over 3000lbs refers to weight > 3000; cost less than $30000 refers to price < 30000;
Question: Among the cars over 3000lbs, how many of them cost less than $30000?
SQL: SELECT count(DATA.car_name) FROM DATA INNER JOIN price ON DATA.id = price.id WHERE DATA.weight > 3000 AND price.price < 30000
Database: cars
Note: the most expensive refers to max(price);
Question: What is the acceleration of the most expensive car?
SQL: SELECT DATA.acceleration FROM DATA INNER JOIN price ON DATA.id = price.id ORDER BY price.price DESC LIMIT 1
Database: cars
Note: cost refers to price; Ford Torino refers to car_name = 'ford torino';
Question: How much US dollars does a Ford Torino cost?
SQL: SELECT price.price FROM DATA INNER JOIN price ON DATA.id = price.id WHERE DATA.car_name = 'ford torino'
Database: cars
Note: origin country refers to country; Ford Torino refers to car_name = 'ford torino'; produced in 1970 refers to model_year = 1970;
Question: What was the origin country of the car model ford torino produced in 1970?
SQL: SELECT country.country FROM DATA INNER JOIN production ON DATA.id = production.id INNER JOIN country ON country.origin = production.country WHERE DATA.car_name = 'ford torino' AND production.model_year = 1970
Database: cars
Note: introduced in the market in 1970 refers to model_year = 1970; have the USA as origin country refers to country = 'USA';
Question: Among the car models introduced in the market in 1970, how many of them have the USA as their origin country?
SQL: SELECT count(*) FROM production INNER JOIN country ON production.country = country.origin WHERE production.model_year = 1970 AND country.country = 'USA'
Database: cars
Note: name of car model refers to car_name; origin country is the USA refers to country = 'USA';
Question: Please list the names of all the car models whose origin country is the USA.
SQL: SELECT DISTINCT DATA.car_name FROM DATA INNER JOIN production ON DATA.id = production.id INNER JOIN country ON production.country = country.origin WHERE country.country = 'USA'
Database: cars
Note: name of the car refers to car_name; the most expensive refers to max(price);
Question: Please list the names of the top 3 most expensive cars.
SQL: SELECT DATA.car_name FROM DATA INNER JOIN price ON DATA.id = price.id ORDER BY price.price DESC LIMIT 3
Database: cars
Note: year refers to model_year; Chevrolet Impala refers to car_name = 'chevrolet impala';
Question: Please list all the years in which the car model Chevrolet Impala was introduced in the market.
SQL: SELECT DISTINCT production.model_year FROM production INNER JOIN DATA ON production.id = DATA.id WHERE DATA.car_name = 'chevrolet impala'
Database: cars
Note: an acceleration of over 10 miles per squared hour refers to acceleration > 10; cost more than $20000 and less than $30000 refers to price < 30000 AND price > 20000;
Question: Among the cars with an acceleration of over 10 miles per squared hour, how many of them cost more than $20000 and less than $30000?
SQL: SELECT count(*) FROM DATA INNER JOIN price ON DATA.id = price.id WHERE DATA.acceleration > 10 AND price.price BETWEEN 20000 AND 30000
Database: cars
Note: price over $40000 refers to price > 40000;
Question: Please list the weights of all the cars with the price over $40000.
SQL: SELECT DATA.weight FROM DATA INNER JOIN price ON DATA.id = price.id WHERE price.price > 40000
Database: cars
Note: the maximum acceleration refers to max(acceleration); price over $40000 refers to price > 40000;
Question: What is the maximum acceleration of a car with price over $40000?
SQL: SELECT max(DATA.acceleration) FROM DATA INNER JOIN price ON DATA.id = price.id WHERE price.price > 40000
Database: cars
Note: with 8 cylinders refers to cylinders = 8; average price = avg(price) where cylinders = 8;
Question: What is the average price of cars with 8 cylinders?
SQL: SELECT avg(price.price) FROM DATA INNER JOIN price ON DATA.id = price.id WHERE DATA.cylinders = 8
Database: cars
Note: cost less than $30000 refers to price < 30000; the maximum sweep volume = max(divide(displacement, cylinders)) where price < 30000;
Question: What is the maximum sweep volume of a car that costs less than $30000?
SQL: SELECT max(DATA.displacement / DATA.cylinders) FROM DATA INNER JOIN price ON DATA.id = price.id WHERE price.price < 30000
Database: cars
Note: originated from Europe refers to country = 'Europe';
Question: How many cars in the database are originated from Europe?
SQL: SELECT count(*) FROM production INNER JOIN country ON production.country = country.origin WHERE country.country = 'Europe'
Database: cars
Note: origin country refers to country; Chevrolet Malibu refers to car_name = 'chevrolet malibu';
Question: Show the origin country of Chevrolet Malibu.
SQL: SELECT country.country FROM DATA INNER JOIN production ON DATA.id = production.id INNER JOIN country ON country.origin = production.country WHERE DATA.car_name = 'chevrolet malibu'
Database: cars
Note: miles per gallon refers to mpg; the most expensive refers to max(price);
Question: What are the miles per gallon of the most expensive car?
SQL: SELECT DATA.mpg FROM DATA INNER JOIN price ON DATA.id = price.id ORDER BY price.price DESC LIMIT 1
Database: cars
Note: origin country refers to country; car no.382 refers to id = 382;
Question: Tell the origin country of car no.382.
SQL: SELECT DISTINCT country.country FROM production INNER JOIN country ON production.country = country.origin WHERE production.id = 382
Database: cars
Note: origin country refers to country; the $44274.40748 car refers to price = 44274.40748;
Question: Which is the origin country of the $44274.40748 car?
SQL: SELECT country.country FROM price INNER JOIN production ON price.id = production.id INNER JOIN country ON country.origin = production.country WHERE price.price = 44274.40748
Database: cars
Note: cost refers to price; Volkswagen Dasher refers to car_name = 'volkswagen dasher'; 14.1 mph acceleration refers to acceleration = 14.1;
Question: How much is the Volkswagen Dasher with 14.1 mph acceleration?
SQL: SELECT price.price FROM DATA INNER JOIN price ON DATA.id = price.id WHERE DATA.car_name = 'volkswagen dasher' AND DATA.acceleration = '14.1'
Database: cars
Note: engine displacement status refers to displacement; the $37443.85589 car refers to price = 37443.85589;
Question: Provide the engine displacement status of the $37443.85589 car.
SQL: SELECT DATA.displacement FROM DATA INNER JOIN price ON DATA.id = price.id WHERE price.price = '37443.85589'
Database: cars
Note: the $32650.65157 car refers to price = 32650.65157; year refers to model;
Question: When was the $32650.65157 car introduced to the market? State the year.
SQL: SELECT DATA.model FROM DATA INNER JOIN price ON DATA.id = price.id WHERE price.price = '32650.65157'
Database: cars
Note: Toyota Corona hardtop refers to car_name = 'toyota corona hardtop';
Question: Provide the price of the only Toyota Corona hardtop in the database.
SQL: SELECT price.price FROM DATA INNER JOIN price ON DATA.id = price.id WHERE DATA.car_name = 'toyota corona hardtop'
Database: cars
Note: the cheapest car refers to min(price);
Question: How many cylinders does the cheapest car have?
SQL: SELECT DATA.cylinders FROM DATA INNER JOIN price ON DATA.id = price.id ORDER BY price ASC LIMIT 1
Database: cars
Note: the best crash protection refers to max(weight); cost refers to price;
Question: Which car in the database provides the best crash protection based on its weight? How much is it?
SQL: SELECT DATA.id, price.price FROM DATA INNER JOIN price ON DATA.id = price.id ORDER BY DATA.weight DESC LIMIT 1
Database: cars
Note: origin country refers to country; the fastest refers to max(horsepower);
Question: State the origin country of the fastest car in the database.
SQL: SELECT country.country FROM DATA INNER JOIN production ON DATA.id = production.id INNER JOIN country ON country.origin = production.country ORDER BY DATA.horsepower DESC LIMIT 1
Database: cars
Note: Japanese car refers to country = 'Japan'; percentage = divide(count(id where country = 'Japan'), count(id)) * 100%;
Question: What is the percentage of Japanese cars in the database?
SQL: SELECT cast(sum(CASE WHEN country.country = 'Japan' THEN 1 ELSE 0 END) AS REAL) * 100 / count(*) FROM production INNER JOIN country ON production.country = country.origin
Database: cars
Note: sweep volume = divide(displacement, cylinders); the $34538.97449 car refers to price = 34538.97449;
Question: Calculate the swept volume of the $34538.97449 car.
SQL: SELECT DATA.displacement / DATA.cylinders FROM DATA INNER JOIN price ON DATA.id = price.id WHERE price.price = 34538.97449
Database: cars
Note: name of the car refers to car_name; the most expensive refers to max(price);
Question: What is the name of the most expensive car?
SQL: SELECT DATA.car_name FROM DATA INNER JOIN price ON DATA.id = price.id ORDER BY price.price DESC LIMIT 1
Database: cars
Note: in the USA refers to country = 'USA'; in 1981 refers to model_year = 1981;
Question: How many cars were released in the USA in 1981?
SQL: SELECT count(*) FROM production INNER JOIN country ON production.country = country.origin WHERE country.country = 'USA' AND production.model_year = 1981
Database: cars
Note: cost refers to price; the highest sweep volume refers to max(divide(displacement, cylinders));
Question: How much is the car with the highest sweep volume?
SQL: SELECT price.price FROM DATA INNER JOIN price ON DATA.id = price.id ORDER BY DATA.displacement / DATA.cylinders DESC LIMIT 1
Database: cars
Note: the fastest refers to max(horsepower); made by Japan refers to country = 'Japan'; name of the car refers to car_name;
Question: What is the fastest car made by Japan?
SQL: SELECT DATA.car_name FROM DATA INNER JOIN production ON DATA.id = production.id INNER JOIN country ON country.origin = production.country WHERE country.country = 'Japan' ORDER BY DATA.horsepower DESC LIMIT 1
Database: cars
Note: Ford Maverick refers to car_name = 'ford maverick';
Question: How many times was Ford Maverick introduced to the market?
SQL: SELECT count(production.model_year) FROM DATA INNER JOIN production ON DATA.id = production.id WHERE DATA.car_name = 'ford maverick'
Database: cars
Note: the most fuel-efficient refers to max(mpg);
Question: Which country produced the most fuel-efficient car?
SQL: SELECT country.country FROM DATA INNER JOIN production ON DATA.id = production.id INNER JOIN country ON country.origin = production.country ORDER BY DATA.mpg DESC LIMIT 1
Database: cars
Note: Dodge car refers to car_name LIKE 'dodge%'; the cheapest refers to min(price); name of the car refers to car_name;
Question: Which Dodge car is the cheapest?
SQL: SELECT DATA.car_name FROM DATA INNER JOIN price ON DATA.id = price.id WHERE DATA.car_name LIKE 'dodge%' ORDER BY price.price ASC LIMIT 1
Database: cars
Note: name of the car refers to car_name; the most expensive refers to max(price); produced by the USA refers to country = 'USA';
Question: What is the name of the most expensive car that was produced by the USA?
SQL: SELECT DATA.car_name FROM price INNER JOIN production ON price.id = production.id INNER JOIN country ON country.origin = production.country INNER JOIN DATA ON DATA.id = price.id WHERE country.country = 'USA' ORDER BY price.price DESC LIMIT 1
Database: cars
Note: engine displacement of no less than 400 cubic millimeter refers to displacement > 400; cost at least 30,000 refers to price > 30000;
Question: Among the cars with an engine displacement of no less than 400 cubic millimeter, how many cars cost at least 30,000?
SQL: SELECT count(*) FROM DATA INNER JOIN price ON DATA.id = price.id WHERE DATA.displacement > 400 AND price.price > 30000
Database: cars
Note: year refers to model_year; Europe refers to country = 'Europe'; the most cars refers to max(model_year);
Question: Which year did Europe produce the most cars?
SQL: SELECT production.model_year FROM production INNER JOIN country ON production.country = country.origin WHERE country.country = 'Europe' GROUP BY production.model_year ORDER BY count(production.model_year) DESC LIMIT 1
Database: cars
Note: cost refers to price; Peugeot 505s Turbo Diesel refers to car_name = 'peugeot 505s turbo diesel';
Question: How much is the Peugeot 505s Turbo Diesel?
SQL: SELECT price.price FROM DATA INNER JOIN price ON DATA.id = price.id WHERE DATA.car_name = 'peugeot 505s turbo diesel'
Database: cars
Note: miles per square hour refers to acceleration; the cheapest refers to min(price); produced by the USA refers to country = 'USA';
Question: What is the miles per square hour of the cheapest car produced by the USA?
SQL: SELECT DATA.acceleration FROM price INNER JOIN production ON price.id = production.id INNER JOIN country ON country.origin = production.country INNER JOIN DATA ON DATA.id = price.id WHERE country.country = 'USA' ORDER BY price.price ASC LIMIT 1
Database: cars
Note: the highest number of cars refers to max(country); annual average number = divide(count(id), count(model_year));
Question: Which country produced the highest number of cars? Calculate the annual average number of cars that the said country produced from the very start to the present.
SQL: SELECT country.country, cast(count(production.id) AS REAL) / count(DISTINCT production.model_year) FROM production INNER JOIN country ON production.country = country.origin GROUP BY country.country ORDER BY count(country.country) DESC LIMIT 1
Database: cars
Note: produced by Japan refers to country = 'Japan'; a sweep volume of no less than 30 refers to divide(displacement, cylinders) > 30; percentage = divide(count(id where country = 'Japan'), count(id)) * 100% where divide(displacement, cylinders) > 30;
Question: What is the percentage of cars that was produced by Japan among those that have a sweep volume of no less than 30?
SQL: SELECT cast(sum(CASE WHEN country.country = 'Japan' THEN 1 ELSE 0 END) AS REAL) * 100 / count(*) FROM DATA INNER JOIN production ON DATA.id = production.id INNER JOIN country ON country.origin = production.country WHERE DATA.displacement / DATA.cylinders > 30
Database: cars
Note: name of the car refers to car_name; model year 1975 refers to model_year = 1975;
Question: List the name of the cars with model year 1975.
SQL: SELECT DATA.car_name FROM DATA INNER JOIN production ON DATA.id = production.id WHERE production.model_year = 1975
Database: cars
Note: from Europe refers to country = 'Europe'; average price = avg(price) where country = 'Europe';
Question: Calculate the average price of cars from Europe.
SQL: SELECT avg(price.price) FROM price INNER JOIN production ON price.id = production.id INNER JOIN country ON country.origin = production.country WHERE country.country = 'Europe'
Database: cars
Question: What is the price of the car ID 15?
SQL: SELECT price.price FROM DATA INNER JOIN price ON DATA.id = price.id WHERE DATA.id = 15
Database: cars
Note: from Japan refers to country = 'Japan'; weighed less than 3000 refers to weight < 3000;
Question: How many of the cars from Japan weighed less than 3000?
SQL: SELECT count(*) FROM price INNER JOIN production ON price.id = production.id INNER JOIN country ON country.origin = production.country INNER JOIN DATA ON DATA.id = price.id WHERE country.country = 'Japan' AND DATA.weight < 3000