Chinastark/bird_dataset huggingface dataset:
Database: cars
Note: produced in year 1973 refers to model_year = 1973; have horsepower less than 100 refers to horsepower < 100;
Question: Among the cars produced in year 1973, how many of the cars have horsepower less than 100?
SQL: SELECT count(*) FROM DATA INNER JOIN production ON DATA.id = production.id WHERE production.model_year = 1973 AND DATA.horsepower < 100
Database: cars
Note: from Japan refers to country = 'Japan'; worth greater than 35000 refers to price > 35000; have an acceleration of 14 refers to acceleration = 14;
Question: Provide the ID of cars from Japan worth greater than 35000 and have an acceleration of 14.
SQL: SELECT DATA.id 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 price.price > 3500 AND DATA.acceleration = 14
Database: cars
Note: the heaviest refers to max(weight);
Question: Give the model year of the heaviest car.
SQL: SELECT production.model_year FROM DATA INNER JOIN production ON DATA.id = production.id ORDER BY DATA.weight DESC LIMIT 1
Database: cars
Note: the car named Subaru Dl refers to car_name = 'subaru dl';
Question: What is the horsepower and model year of the car named Subaru Dl?
SQL: SELECT DATA.horsepower, production.model_year FROM DATA INNER JOIN production ON DATA.id = production.id WHERE DATA.car_name = 'subaru dl'
Database: cars
Note: from Japan refers to country = 'Japan'; name of the car refers to car_name; the highest price refers to max(price);
Question: Among the cars originated from Japan, what is the name of the car with the highest price?
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 = 'Japan' ORDER BY price.price DESC LIMIT 1
Database: cars
Note: name of the car refers to car_name; worth 20000 refers to price = 20000;
Question: What are the names of the cars worth 20000?
SQL: SELECT DATA.car_name FROM DATA INNER JOIN price ON DATA.id = price.id WHERE price.price = 20000
Database: cars
Note: worth greater than 40000 refers to price > 40000; from the USA refers to country = 'USA';
Question: How many cars worth greater than 40000 were from the USA?
SQL: SELECT count(*) FROM price INNER JOIN production ON price.id = production.id INNER JOIN country ON country.origin = production.country WHERE country.country = 'USA' AND price.price > 40000
Database: cars
Note: country origin refers to country; Ford Maverick refers to car_name = 'ford maverick';
Question: Provide the price and country origin of the car named Ford Maverick.
SQL: SELECT DISTINCT price.price, country.country 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 DATA.car_name = 'ford maverick'
Database: cars
Note: car's name refers to car_name; a price worth greater than 85% of the average price of all cars refers to price > multiply(avg(price), 0.85);
Question: List the car's name with a price worth greater than 85% of the average price of all cars.
SQL: SELECT DATA.car_name FROM DATA INNER JOIN price ON DATA.id = price.id WHERE price.price * 100 > ( SELECT avg(price) * 85 FROM price )
Database: cars
Note: a horsepower of 130 refers to horsepower = 130; difference = subtract(count(id where model_year = 1970), count(id where model_year = 1976)) where horsepower = 130;
Question: Calculate the difference between the number of cars that has a horsepower of 130 with the model year 1970 and model year 1976
SQL: SELECT sum(CASE WHEN production.model_year = 1970 THEN 1 ELSE 0 END) - sum(CASE WHEN production.model_year = 1976 THEN 1 ELSE 0 END) FROM DATA INNER JOIN production ON DATA.id = production.id WHERE DATA.horsepower = 130
Database: cars
Note: from Asia refers to country = 'Japan'; introduced in 1979 refers to model_year = 1979;
Question: Among the cars from Asia, list the IDs of cars that were introduced in 1979.
SQL: SELECT production.id FROM production INNER JOIN country ON production.country = country.origin WHERE country.country = 'Japan' AND production.model_year = 1979
Database: cars
Note: the lowest mileage per gallon refers to min(mpg);
Question: Which country produced the car with the lowest mileage per gallon?
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 ASC LIMIT 1
Database: cars
Note: car's name refers to car_name; sweep volume = divide(displacement, cylinders); introduced year refers to model_year; the best crash protection refers to max(weight);
Question: Provide the name, model, sweep volume, and introduced year of the car with the best crash protection.
SQL: SELECT DATA.car_name, DATA.model, DATA.displacement / DATA.cylinders, production.model_year FROM DATA INNER JOIN production ON DATA.id = production.id ORDER BY DATA.weight DESC LIMIT 1
Database: cars
Note: introduced in 1977 refers to model_year = 1977; car's name refers to car_name; from Europe refers to country = 'Europe';
Question: Among the cars introduced in 1977, provide the names and the horse powers of cars from Europe.
SQL: SELECT DATA.car_name, DATA.horsepower FROM DATA INNER JOIN production ON DATA.id = production.id INNER JOIN country ON country.origin = production.country WHERE production.model_year = 1977 AND country.country = 'Europe'
Database: cars
Note: car's name refers to car_name; the highest price refers to max(price);
Question: Provide the name and model of the car with the highest price.
SQL: SELECT DATA.car_name, DATA.model FROM DATA INNER JOIN price ON DATA.id = price.id ORDER BY price.price DESC LIMIT 1
Database: cars
Note: Chevrolet Bel Air refers to car_name = 'chevrolet bel air';
Question: What is the price of a Chevrolet Bel Air?
SQL: SELECT price.price FROM DATA INNER JOIN price ON DATA.id = price.id WHERE DATA.car_name = 'chevrolet bel air'
Database: cars
Note: produced in Japan refers to country = 'Japan'; average price per car = avg(price) where country = 'Japan';
Question: What is the average price per car produced in Japan?
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 = 'Japan'
Database: cars
Note: the lowest price refers to min(price);
Question: Which country produced the car with the lowest price?
SQL: SELECT country.country FROM price INNER JOIN production ON price.id = production.id INNER JOIN country ON country.origin = production.country ORDER BY price.price ASC LIMIT 1
Database: cars
Note: produced in 1975 refers to model_year = 1975; names refers to car_name; producing countries refers to country; the maximum number of cylinders refers to max(cylinders);
Question: Among the cars produced in 1975, provide IDs, names, and producing countries of the cars with the maximum number of cylinders.
SQL: SELECT DATA.id, DATA.car_name, country.country FROM DATA INNER JOIN production ON DATA.id = production.id INNER JOIN country ON country.origin = production.country WHERE production.model_year = 1975 ORDER BY DATA.cylinders DESC LIMIT 1
Database: cars
Note: the cheapest refers to min(price); number of cylinders refers to cylinders; producing year refers to model_year;
Question: Which car is the cheapest? Provide its acceleration, number of cylinders, and producing year.
SQL: SELECT DATA.acceleration, DATA.cylinders, production.model_year FROM DATA INNER JOIN production ON DATA.id = production.id INNER JOIN price ON price.id = production.id ORDER BY price.price ASC LIMIT 1
Database: cars
Note: car's name refers to car_name; model 82 refers to model = 82; mileage per gallon of greater than 30 refers to mpg > 30;
Question: List the names and prices of the cars with model 82 and mileage per gallon of greater than 30.
SQL: SELECT DATA.car_name, price.price FROM price INNER JOIN DATA ON price.id = DATA.id WHERE DATA.model = 82 AND DATA.mpg > 30
Database: cars
Note: Ford Maverick refers to car_name = 'ford maverick';
Question: How many models of Ford Maverick were produced?
SQL: SELECT count(DISTINCT production.model_year) FROM DATA INNER JOIN production ON DATA.id = production.id WHERE DATA.car_name = 'ford maverick'
Database: cars
Note: belong to the USA refers to country = 'USA'; percentage = divide(count(id where country = 'USA'), count(id)) * 100%;
Question: Calculate the percentage of cars that belong to the USA.
SQL: SELECT cast(sum(CASE WHEN country.country = 'USA' THEN 1 ELSE 0 END) AS REAL) * 100 / count(*) FROM production INNER JOIN country ON production.country = country.origin
Database: cars
Note: from 1971 to 1980 refers to model_year between 1971 and 1980; average production rate per year = divide(count(id where model_year between 1971 and 1980), 9); car's name refers to car_name; a weight of fewer than 1800 lbs refers to weight < 1800;
Question: Calculate the average production rate per year from 1971 to 1980. Among them, name the cars with a weight of fewer than 1800 lbs.
SQL: SELECT cast(count(production.id) AS REAL) / 9 FROM production INNER JOIN DATA ON DATA.id = production.id WHERE production.model_year BETWEEN 1971 AND 1980 UNION ALL SELECT DISTINCT DATA.car_name FROM production INNER JOIN DATA ON DATA.id = production.id WHERE production.model_year BETWEEN 1971 AND 1980 AND DATA.weight < 1800
Database: cars
Note: model 70 refers to model = 70; average price = avg(price) where model = 70;
Question: What is the average price of model 70 cars?
SQL: SELECT avg(price.price) FROM DATA INNER JOIN price ON DATA.id = price.id WHERE DATA.model = 70
Database: cars
Note: Chevrolet Vega 2300 refers to car_name = 'chevrolet vega 2300';
Question: What is the price of Chevrolet Vega 2300?
SQL: SELECT price.price FROM DATA INNER JOIN price ON DATA.id = price.id WHERE DATA.car_name = 'chevrolet vega 2300'
Database: cars
Note: Chevy C20 refers to car_name = 'chevy c20';
Question: Which country does Chevy C20 come from?
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 = 'chevy c20'
Database: cars
Note: Ford cars refers to car_name LIKE 'ford%'; from model 1970 to 1980 refers to model_year BETWEEN 1970 AND 1980;
Question: List the price of Ford cars from model 1970 to 1980.
SQL: SELECT DISTINCT price.price FROM DATA INNER JOIN production ON DATA.id = production.id INNER JOIN price ON price.id = production.id WHERE DATA.car_name LIKE 'ford%' AND production.model_year BETWEEN 1970 AND 1980
Database: cars
Note: car's name refers to car_name; the most fuel efficient refers to max(mpg); in 1975 refers to model_year = 1975;
Question: Which is the most fuel efficient car in 1975?
SQL: SELECT DATA.car_name FROM DATA INNER JOIN production ON DATA.id = production.id WHERE production.model_year = '1975' ORDER BY DATA.mpg DESC LIMIT 1
Database: cars
Note: consumes fuel the most refers to min(mpg); has the highest price refers to max(price);
Question: Which car consumes fuel the most and has the highest price?
SQL: SELECT DATA.car_name FROM DATA INNER JOIN price ON DATA.id = price.id ORDER BY DATA.mpg DESC, price.price DESC LIMIT 1
Database: cars
Note: American car refers to country = 'USA'; an acceleration time of less than 12 seconds refers to acceleration < 12;
Question: How many American cars have an acceleration time of less than 12 seconds?
SQL: SELECT count(*) FROM DATA INNER JOIN production ON DATA.id = production.id INNER JOIN country ON country.origin = production.country WHERE country.country = 'USA' AND DATA.acceleration < 12
Database: cars
Note: Japanese car refers to country = 'Japan'; weigh more than 2000 lbs refers to weight > 2000;
Question: How many Japanese cars weigh more than 2000 lbs?
SQL: SELECT count(*) FROM DATA INNER JOIN production ON DATA.id = production.id INNER JOIN country ON country.origin = production.country WHERE country.country = 'Japan' AND DATA.weight > 2000
Database: cars
Note: car's name refers to car_name; the most expensive refers to max(price);
Question: List 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: year refers to model_year; Buick Skylark 320 refers to car_name = 'buick skylark 320';
Question: What years did the Buick Skylark 320 get in production?
SQL: SELECT production.model_year FROM DATA INNER JOIN production ON DATA.id = production.id WHERE DATA.car_name = 'buick skylark 320'
Database: cars
Note: the most expensive refers to max(price); in 1970 refers to model_year = 1970;
Question: Which country produced the most expensive car in 1970?
SQL: SELECT country.country FROM DATA INNER JOIN production ON DATA.id = production.id INNER JOIN country ON country.origin = production.country INNER JOIN price ON price.id = DATA.id WHERE production.model_year = 1970 ORDER BY price.price DESC LIMIT 1
Database: cars
Note: horsepower greater than 200 refers to horsepower > 200; in 1975 refers to model_year = 1975;
Question: How many cars with horsepower greater than 200 were produced in 1975?
SQL: SELECT count(production.model_year) FROM DATA INNER JOIN production ON DATA.id = production.id WHERE DATA.horsepower > 200 AND production.model_year = 1975
Database: cars
Note: American car refers to country = 'USA'; percentage = divide(count(id where country = 'USA'), count(id)) * 100%;
Question: Calculate the percentage of American cars among all cars.
SQL: SELECT cast(sum(CASE WHEN country.country = 'USA' 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
Database: cars
Note: Japanese car refers to country = 'Japan'; with 4 cylinders refers to cylinders = 4; produced from 1975 to 1980 refers to model_year BETWEEN 1975 AND 1980; average weight = avg(weight);
Question: What is the average weight of Japanese cars with 4 cylinders that were produced from 1975 to 1980?
SQL: SELECT avg(DATA.weight) FROM DATA INNER JOIN production ON DATA.id = production.id INNER JOIN country ON country.origin = production.country WHERE production.model_year BETWEEN 1975 AND 1980 AND DATA.cylinders = 4 AND country.country = 'Japan'
Database: donor
Note: total amount of donations refers to sum(donation_total); 2012 refers to donation_timestamp LIKE'2012%';
Question: What is the total amount of donations in 2012.
SQL: SELECT sum(donation_total) FROM donations WHERE donation_timestamp LIKE '2012%'
Database: donor
Note: when refers donation_timestamp; the highest amount refers to max(donation_total);
Question: When was the highest amount of donated? How much was the amount?
SQL: SELECT donation_timestamp, donation_total FROM donations WHERE donation_total = ( SELECT donation_total FROM donations ORDER BY donation_total DESC LIMIT 1 )
Database: donor
Note: total amount refers to sum(donation_total); 2011 refers to donation_timestamp LIKE'2011%'; honoree refers to for_honoree = 't'; via campaign page refers to via_giving_page = 't';
Question: Calculate the total amount of donations made in 2011 for an honoree with payment via campaign page.
SQL: SELECT sum(donation_total) FROM donations WHERE donation_timestamp LIKE '2011%' AND via_giving_page = 't' AND for_honoree = 't'
Database: donor
Note: not from a teacher refers to is_teacher_acct = 'f'; donor account id refers to donor_acctid; percentage of donation = divide(donation_optional_support, donation_total)*100%;
Question: For each donation not from a teacher, state the donor account id and calculate the percentage of donation given for optional support.
SQL: SELECT donor_acctid, donation_optional_support / donation_total FROM donations WHERE is_teacher_acct = 'f'
Database: donor
Note: intended mainly for literary refers to primary_focus_subject = 'Literacy';
Question: Name all the project titles whereby project materials are intended mainly for literary.
SQL: SELECT essays.title FROM essays INNER JOIN projects ON essays.projectid = projects.projectid WHERE projects.primary_focus_subject = 'Literacy'
Database: donor
Note: 65% of the students are on reduced lunch refers to poverty_level = 'highest poverty';
Question: Name the project titles meant for school whereby 65% of the students are on reduced lunch.
SQL: SELECT essays.title FROM essays INNER JOIN projects ON essays.projectid = projects.projectid WHERE projects.poverty_level LIKE 'highest%'
Database: donor
Note: main subject refers to primary_focus_subject;
Question: For project titled 'Toot Your Flute!', what is the main subject of the project materials intended for? Name the other projects with the similar focus.
SQL: SELECT projects.primary_focus_subject FROM essays INNER JOIN projects ON essays.projectid = projects.projectid WHERE essays.title = 'Toot Your Flute!'
Database: donor
Note: teacher who acquired a doctor degree refers to teacher_prefix = 'Dr.';
Question: Name the project titles created by teacher who acquired a doctor degree.
SQL: SELECT essays.title FROM essays INNER JOIN donations ON essays.projectid = donations.projectid WHERE donations.donation_message LIKE 'Donation on behalf of Matt Carpenter because I''m a strong believer in education.'
Database: donor
Note: 320 students will be impacted refers to students_reached = 320; name the project refers to title; project cost refers tp total_price_excluding_optional_support;
Question: What is the project in which 320 students will be impacted if the project is funded? Name the project and state the project cost.
SQL: SELECT essays.title, projects.total_price_excluding_optional_support FROM essays INNER JOIN projects ON essays.projectid = projects.projectid WHERE projects.students_reached = 320
Database: donor
Note: from Texas City refers to donor_city = 'Texas City'; name of the project refers title;
Question: For all donors from Texas City, list their donation message and name of the project they donated to.
SQL: SELECT donations.donation_message, essays.title FROM essays INNER JOIN donations ON essays.projectid = donations.projectid WHERE donations.donor_city = 'Texas City'
Database: donor
Note: project 'Lights, Camera, Action!' refers to title = 'Lights, Camera, Action!';
Question: Name the vendors who provide resources for project 'Lights, Camera, Action!'. List all the item names and unit price for each.
SQL: SELECT resources.vendor_name, resources.item_name, resources.item_unit_price FROM resources INNER JOIN projects ON resources.projectid = projects.projectid INNER JOIN essays ON projects.projectid = essays.projectid WHERE essays.title = 'Lights, Camera, Action!'
Database: donor
Note: donations collected refers to sum(donation_to_project); project 'Whistle While We Work!' refers to title = 'Whistle While We Work!';
Question: How much donations have been collected for project 'Whistle While We Work!'?
SQL: SELECT sum(donations.donation_to_project) FROM essays INNER JOIN donations ON essays.projectid = donations.projectid WHERE essays.title = 'Whistle While We Work!'
Database: donor
Note: project name refers to title; describe refers to short_description; New York teachers refers to teacher_ny_teaching_fellow = 't';
Question: Name and describe all projects created by New York teachers.
SQL: SELECT essays.title, essays.short_description FROM essays INNER JOIN projects ON essays.projectid = projects.projectid WHERE projects.teacher_ny_teaching_fellow = 't'
Database: donor
Note: impact at least 600 students refers to students_reached >= 600; moderate level of poverty refers to poverty_level = 'moderate poverty'; project name refers to title; project cost refers to total_price_excluding_optional_support;
Question: If funded, which are the projects that could impact at least 600 students for a school with moderate level of poverty? Name the projects and state the project cost.
SQL: SELECT DISTINCT essays.title, projects.total_price_excluding_optional_support FROM projects INNER JOIN essays ON projects.projectid = essays.projectid WHERE projects.students_reached >= 600 AND projects.poverty_level LIKE 'moderate poverty'
Database: donor
Note: located in the rural area refers to school_metro = 'rural'; percentage = divide(sum(donation_to_project), sum(donation_to_project where school_metro = 'rural'))*100%;
Question: From the total amount of donation to projects, what is the percentage of the amount is for school projects located in the rural area?
SQL: SELECT cast(sum(CASE WHEN projects.school_metro = 'rural' THEN donations.donation_to_project ELSE 0 END) AS REAL) * 100 / sum(donation_to_project) FROM donations INNER JOIN projects ON donations.projectid = projects.projectid
Database: donor
Note: project name refers to title; costs the most refers to max(total_price_excluding_optional_support); amount collected from donation refers to sum(donation_to_project); percentage amount refers to divide(subtract(total_price_excluding_optional_support, sum(donation_to_project)), sum(donation_to_project))*100%;
Question: Name the project that costs the most. How much has been collected from donation and what is the percentage amount still lacking?
SQL: SELECT essays.title, sum(donations.donation_to_project), cast((projects.total_price_excluding_optional_support - sum(donations.donation_to_project)) AS REAL) * 100 / sum(donations.donation_to_project) FROM essays INNER JOIN projects ON essays.projectid = projects.projectid INNER JOIN donations ON projects.projectid = donations.projectid ORDER BY projects.total_price_excluding_optional_support DESC LIMIT 1
Database: donor
Note: the highest poverty level refers to poverty_level = 'highest poverty';
Question: How many schools in the West New York School District have the highest poverty level?
SQL: SELECT count(poverty_level) FROM projects WHERE school_district = 'West New York School District' AND poverty_level = 'highest poverty'
Database: donor
Note: from teachers refers to is_teacher_acct = 't'; the state of Colorado refers to donor_state = 'CO-Colorado';
Question: How many donations from teachers were done in the state of Colorado?
SQL: SELECT count(donationid) FROM donations WHERE is_teacher_acct = 't' AND donor_state = 'CO'
Database: donor
Note: highest total price including optional support refers to max(total_price_including_optional_support);
Question: Which project have the highest total price including optional support? Indicate the project id.
SQL: SELECT projectid FROM projects ORDER BY total_price_including_optional_support DESC LIMIT 1
Database: donor
Note: which state refers to donor_state; highest number refers to max(count(donor_state)); PayPal donations refers to payment_method = 'paypal'; for an honoree refers to for_honoree = 't'; included corporate sponsored giftcard refers to payment_included_campaign_gift_card = 't';
Question: Which state have the highest number of PayPal donations for an honoree whose portion of a donation included corporate sponsored giftcard?
SQL: SELECT DISTINCT donor_state FROM donations WHERE for_honoree = 't' AND payment_included_campaign_gift_card = 't' AND payment_method = 'paypal' AND donor_state = ( SELECT donor_state FROM donations GROUP BY donor_state ORDER BY sum(donation_total) DESC LIMIT 1 )
Database: donor
Note: largest donor by amount refers to max(donation_total); total amount of the donation refers to donation_total;
Question: Who is the largest donor by amount? Give the donation id and the total amount of the donation.
SQL: SELECT donationid, donation_total FROM donations ORDER BY donation_total DESC LIMIT 1
Database: donor
Note: highest optional tip refers to subtract(total_price_including_optional_support, total_price_excluding_optional_support); names of the resources refers to item_name;
Question: What is the id of the project that has the highest optional tip? Indicate the names of the resources that were requested.
SQL: SELECT resources.projectid, resources.item_name FROM resources INNER JOIN projects ON resources.projectid = projects.projectid ORDER BY projects.total_price_including_optional_support - projects.total_price_excluding_optional_support DESC LIMIT 1