combined_text
stringlengths 106
1.05k
|
---|
###question:Please show the date of ceremony of the volumes that last more than 2 weeks on top.###answer:SELECT T1.Date_of_ceremony FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume = T2.Volume_ID WHERE T2.Weeks_on_Top > 2###context:CREATE TABLE music_festival (Date_of_ceremony VARCHAR, Volume VARCHAR); CREATE TABLE volume (Volume_ID VARCHAR, Weeks_on_Top INTEGER) |
###question:Please show the songs that have result "nominated" at music festivals.###answer:SELECT T2.Song FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume = T2.Volume_ID WHERE T1.Result = "Nominated"###context:CREATE TABLE volume (Song VARCHAR, Volume_ID VARCHAR); CREATE TABLE music_festival (Volume VARCHAR, Result VARCHAR) |
###question:What are the issue dates of volumes associated with the artist "Gorgoroth"?###answer:SELECT T2.Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Artist = "Gorgoroth"###context:CREATE TABLE artist (Artist_ID VARCHAR, Artist VARCHAR); CREATE TABLE volume (Issue_Date VARCHAR, Artist_ID VARCHAR) |
###question:What are the songs in volumes associated with the artist aged 32 or older?###answer:SELECT T2.Song FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age >= 32###context:CREATE TABLE volume (Song VARCHAR, Artist_ID VARCHAR); CREATE TABLE artist (Artist_ID VARCHAR, age VARCHAR) |
###question:What is the average weeks on top of volumes associated with the artist aged 25 or younger?###answer:SELECT AVG(T2.Weeks_on_Top) FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age <= 25###context:CREATE TABLE volume (Weeks_on_Top INTEGER, Artist_ID VARCHAR); CREATE TABLE artist (Artist_ID VARCHAR, age VARCHAR) |
###question:What are the famous title of the artists associated with volumes with more than 2 weeks on top?###answer:SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top > 2###context:CREATE TABLE artist (Famous_Title VARCHAR, Artist_ID VARCHAR); CREATE TABLE volume (Artist_ID VARCHAR, Weeks_on_Top INTEGER) |
###question:Please list the age and famous title of artists in descending order of age.###answer:SELECT Famous_Title, Age FROM artist ORDER BY Age DESC###context:CREATE TABLE artist (Famous_Title VARCHAR, Age VARCHAR) |
###question:What is the famous release date of the artist with the oldest age?###answer:SELECT Famous_Release_date FROM artist ORDER BY Age DESC LIMIT 1###context:CREATE TABLE artist (Famous_Release_date VARCHAR, Age VARCHAR) |
###question:Please show the categories of the music festivals and the count.###answer:SELECT Category, COUNT(*) FROM music_festival GROUP BY Category###context:CREATE TABLE music_festival (Category VARCHAR) |
###question:What is the most common result of the music festival?###answer:SELECT RESULT FROM music_festival GROUP BY RESULT ORDER BY COUNT(*) DESC LIMIT 1###context:CREATE TABLE music_festival (RESULT VARCHAR) |
###question:Please show the categories of the music festivals with count more than 1.###answer:SELECT Category FROM music_festival GROUP BY Category HAVING COUNT(*) > 1###context:CREATE TABLE music_festival (Category VARCHAR) |
###question:What is the song in the volume with the maximum weeks on top?###answer:SELECT Song FROM volume ORDER BY Weeks_on_Top DESC LIMIT 1###context:CREATE TABLE volume (Song VARCHAR, Weeks_on_Top VARCHAR) |
###question:Find the famous titles of artists that do not have any volume.###answer:SELECT Famous_Title FROM artist WHERE NOT Artist_ID IN (SELECT Artist_ID FROM volume)###context:CREATE TABLE volume (Famous_Title VARCHAR, Artist_ID VARCHAR); CREATE TABLE artist (Famous_Title VARCHAR, Artist_ID VARCHAR) |
###question:Show the famous titles of the artists with both volumes that lasted more than 2 weeks on top and volumes that lasted less than 2 weeks on top.###answer:SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top > 2 INTERSECT SELECT T1.Famous_Title FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T2.Weeks_on_Top < 2###context:CREATE TABLE artist (Famous_Title VARCHAR, Artist_ID VARCHAR); CREATE TABLE volume (Artist_ID VARCHAR, Weeks_on_Top INTEGER) |
###question:What are the date of ceremony of music festivals with category "Best Song" and result "Awarded"?###answer:SELECT Date_of_ceremony FROM music_festival WHERE Category = "Best Song" AND RESULT = "Awarded"###context:CREATE TABLE music_festival (Date_of_ceremony VARCHAR, Category VARCHAR, RESULT VARCHAR) |
###question:What is the issue date of the volume with the minimum weeks on top?###answer:SELECT Issue_Date FROM volume ORDER BY Weeks_on_Top LIMIT 1###context:CREATE TABLE volume (Issue_Date VARCHAR, Weeks_on_Top VARCHAR) |
###question:Please show the results of music festivals and the number of music festivals that have had each, ordered by this count.###answer:SELECT RESULT, COUNT(*) FROM music_festival GROUP BY RESULT ORDER BY COUNT(*) DESC###context:CREATE TABLE music_festival (RESULT VARCHAR) |
###question:What are the issue dates of volumes associated with the artist aged 23 or younger?###answer:SELECT Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.age <= 23###context:CREATE TABLE volume (Artist_ID VARCHAR); CREATE TABLE artist (Artist_ID VARCHAR, age VARCHAR) |
###question:How many roller coasters are there?###answer:SELECT COUNT(*) FROM roller_coaster###context:CREATE TABLE roller_coaster (Id VARCHAR) |
###question:List the names of roller coasters by ascending order of length.###answer:SELECT Name FROM roller_coaster ORDER BY LENGTH###context:CREATE TABLE roller_coaster (Name VARCHAR, LENGTH VARCHAR) |
###question:What are the lengths and heights of roller coasters?###answer:SELECT LENGTH, Height FROM roller_coaster###context:CREATE TABLE roller_coaster (LENGTH VARCHAR, Height VARCHAR) |
###question:List the names of countries whose language is not "German".###answer:SELECT Name FROM country WHERE Languages <> "German"###context:CREATE TABLE country (Name VARCHAR, Languages VARCHAR) |
###question:Show the statuses of roller coasters longer than 3300 or higher than 100.###answer:SELECT Status FROM roller_coaster WHERE LENGTH > 3300 OR Height > 100###context:CREATE TABLE roller_coaster (Status VARCHAR, LENGTH VARCHAR, Height VARCHAR) |
###question:What are the speeds of the longest roller coaster?###answer:SELECT Speed FROM roller_coaster ORDER BY LENGTH DESC LIMIT 1###context:CREATE TABLE roller_coaster (Speed VARCHAR, LENGTH VARCHAR) |
###question:What is the average speed of roller coasters?###answer:SELECT AVG(Speed) FROM roller_coaster###context:CREATE TABLE roller_coaster (Speed INTEGER) |
###question:Show the different statuses and the numbers of roller coasters for each status.###answer:SELECT Status, COUNT(*) FROM roller_coaster GROUP BY Status###context:CREATE TABLE roller_coaster (Status VARCHAR) |
###question:Please show the most common status of roller coasters.###answer:SELECT Status FROM roller_coaster GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1###context:CREATE TABLE roller_coaster (Status VARCHAR) |
###question:List the status shared by more than two roller coaster.###answer:SELECT Status FROM roller_coaster GROUP BY Status HAVING COUNT(*) > 2###context:CREATE TABLE roller_coaster (Status VARCHAR) |
###question:Show the park of the roller coaster with the highest speed.###answer:SELECT Park FROM roller_coaster ORDER BY Speed DESC LIMIT 1###context:CREATE TABLE roller_coaster (Park VARCHAR, Speed VARCHAR) |
###question:Show the names of roller coasters and names of country they are in.###answer:SELECT T2.Name, T1.Name FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID###context:CREATE TABLE country (Name VARCHAR, Country_ID VARCHAR); CREATE TABLE roller_coaster (Name VARCHAR, Country_ID VARCHAR) |
###question:Show the names of countries that have more than one roller coaster.###answer:SELECT T1.Name FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID GROUP BY T1.Name HAVING COUNT(*) > 1###context:CREATE TABLE roller_coaster (Country_ID VARCHAR); CREATE TABLE country (Name VARCHAR, Country_ID VARCHAR) |
###question:Show the name and population of the country that has the highest roller coaster.###answer:SELECT T1.Name, T1.population FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID ORDER BY T2.Height DESC LIMIT 1###context:CREATE TABLE roller_coaster (Country_ID VARCHAR, Height VARCHAR); CREATE TABLE country (Name VARCHAR, population VARCHAR, Country_ID VARCHAR) |
###question:Show the names of countries and the average speed of roller coasters from each country.###answer:SELECT T1.Name, AVG(T2.Speed) FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID GROUP BY T1.Name###context:CREATE TABLE roller_coaster (Speed INTEGER, Country_ID VARCHAR); CREATE TABLE country (Name VARCHAR, Country_ID VARCHAR) |
###question:How many countries do not have an roller coaster longer than 3000?###answer:SELECT COUNT(*) FROM country WHERE NOT country_id IN (SELECT country_id FROM roller_coaster WHERE LENGTH > 3000)###context:CREATE TABLE country (country_id VARCHAR, LENGTH INTEGER); CREATE TABLE roller_coaster (country_id VARCHAR, LENGTH INTEGER) |
###question:What are the country names, area and population which has both roller coasters with speed higher###answer:SELECT T1.name, T1.area, T1.population FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID WHERE T2.speed > 60 INTERSECT SELECT T1.name, T1.area, T1.population FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID WHERE T2.speed < 55###context:CREATE TABLE country (name VARCHAR, area VARCHAR, population VARCHAR, Country_ID VARCHAR); CREATE TABLE roller_coaster (Country_ID VARCHAR, speed INTEGER) |
###question:How many different captain ranks are there?###answer:SELECT COUNT(DISTINCT rank) FROM captain###context:CREATE TABLE captain (rank VARCHAR) |
###question:How many captains are in each rank?###answer:SELECT COUNT(*), rank FROM captain GROUP BY rank###context:CREATE TABLE captain (rank VARCHAR) |
###question:How many captains with younger than 50 are in each rank?###answer:SELECT COUNT(*), rank FROM captain WHERE age < 50 GROUP BY rank###context:CREATE TABLE captain (rank VARCHAR, age INTEGER) |
###question:Sort all captain names by their ages from old to young.###answer:SELECT name FROM captain ORDER BY age DESC###context:CREATE TABLE captain (name VARCHAR, age VARCHAR) |
###question:Find the name, class and rank of all captains.###answer:SELECT name, CLASS, rank FROM captain###context:CREATE TABLE captain (name VARCHAR, CLASS VARCHAR, rank VARCHAR) |
###question:Which rank is the most common among captains?###answer:SELECT rank FROM captain GROUP BY rank ORDER BY COUNT(*) DESC LIMIT 1###context:CREATE TABLE captain (rank VARCHAR) |
###question:Which classes have more than two captains?###answer:SELECT CLASS FROM captain GROUP BY CLASS HAVING COUNT(*) > 2###context:CREATE TABLE captain (CLASS VARCHAR) |
###question:Find the name of captains whose rank are either Midshipman or Lieutenant.###answer:SELECT name FROM captain WHERE rank = 'Midshipman' OR rank = 'Lieutenant'###context:CREATE TABLE captain (name VARCHAR, rank VARCHAR) |
###question:What are the average and minimum age of captains in different class?###answer:SELECT AVG(age), MIN(age), CLASS FROM captain GROUP BY CLASS###context:CREATE TABLE captain (CLASS VARCHAR, age INTEGER) |
###question:Find the captain rank that has some captains in both Cutter and Armed schooner classes.###answer:SELECT rank FROM captain WHERE CLASS = 'Cutter' INTERSECT SELECT rank FROM captain WHERE CLASS = 'Armed schooner'###context:CREATE TABLE captain (rank VARCHAR, CLASS VARCHAR) |
###question:Find the captain rank that has no captain in Third-rate ship of the line class.###answer:SELECT rank FROM captain EXCEPT SELECT rank FROM captain WHERE CLASS = 'Third-rate ship of the line'###context:CREATE TABLE captain (rank VARCHAR, CLASS VARCHAR) |
###question:What is the name of the youngest captain?###answer:SELECT name FROM captain ORDER BY age LIMIT 1###context:CREATE TABLE captain (name VARCHAR, age VARCHAR) |
###question:Find the name, type, and flag of the ship that is built in the most recent year.###answer:SELECT name, TYPE, flag FROM ship ORDER BY built_year DESC LIMIT 1###context:CREATE TABLE ship (name VARCHAR, TYPE VARCHAR, flag VARCHAR, built_year VARCHAR) |
###question:Group by ships by flag, and return number of ships that have each flag.###answer:SELECT COUNT(*), flag FROM ship GROUP BY flag###context:CREATE TABLE ship (flag VARCHAR) |
###question:Which flag is most widely used among all ships?###answer:SELECT flag FROM ship GROUP BY flag ORDER BY COUNT(*) DESC LIMIT 1###context:CREATE TABLE ship (flag VARCHAR) |
###question:List all ship names in the order of built year and class.###answer:SELECT name FROM ship ORDER BY built_year, CLASS###context:CREATE TABLE ship (name VARCHAR, built_year VARCHAR, CLASS VARCHAR) |
###question:Find the ship type that are used by both ships with Panama and Malta flags.###answer:SELECT TYPE FROM ship WHERE flag = 'Panama' INTERSECT SELECT TYPE FROM ship WHERE flag = 'Malta'###context:CREATE TABLE ship (TYPE VARCHAR, flag VARCHAR) |
###question:In which year were most of ships built?###answer:SELECT built_year FROM ship GROUP BY built_year ORDER BY COUNT(*) DESC LIMIT 1###context:CREATE TABLE ship (built_year VARCHAR) |
###question:Find the name of the ships that have more than one captain.###answer:SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id GROUP BY t2.ship_id HAVING COUNT(*) > 1###context:CREATE TABLE captain (ship_id VARCHAR); CREATE TABLE ship (name VARCHAR, ship_id VARCHAR) |
###question:what are the names and classes of the ships that do not have any captain yet?###answer:SELECT name, CLASS FROM ship WHERE NOT ship_id IN (SELECT ship_id FROM captain)###context:CREATE TABLE ship (name VARCHAR, CLASS VARCHAR, ship_id VARCHAR); CREATE TABLE captain (name VARCHAR, CLASS VARCHAR, ship_id VARCHAR) |
###question:Find the name of the ship that is steered by the youngest captain.###answer:SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id ORDER BY t2.age LIMIT 1###context:CREATE TABLE ship (name VARCHAR, ship_id VARCHAR); CREATE TABLE captain (ship_id VARCHAR, age VARCHAR) |
###question:Find the name and flag of ships that are not steered by any captain with Midshipman rank.###answer:SELECT name, flag FROM ship WHERE NOT ship_id IN (SELECT ship_id FROM captain WHERE rank = 'Midshipman')###context:CREATE TABLE captain (name VARCHAR, flag VARCHAR, ship_id VARCHAR, rank VARCHAR); CREATE TABLE ship (name VARCHAR, flag VARCHAR, ship_id VARCHAR, rank VARCHAR) |
###question:Find the name of the ships that are steered by both a captain with Midshipman rank and a captain with Lieutenant rank.###answer:SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Midshipman' INTERSECT SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Lieutenant'###context:CREATE TABLE ship (name VARCHAR, ship_id VARCHAR); CREATE TABLE captain (ship_id VARCHAR, rank VARCHAR) |
###question:What is id of the city that hosted events in the most recent year?###answer:SELECT host_city FROM hosting_city ORDER BY YEAR DESC LIMIT 1###context:CREATE TABLE hosting_city (host_city VARCHAR, YEAR VARCHAR) |
###question:Find the match ids of the cities that hosted competition "1994 FIFA World Cup qualification"?###answer:SELECT match_id FROM MATCH WHERE competition = "1994 FIFA World Cup qualification"###context:CREATE TABLE MATCH (match_id VARCHAR, competition VARCHAR) |
###question:Find the cities which were once a host city after 2010?###answer:SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T2.year > 2010###context:CREATE TABLE city (city VARCHAR, city_id VARCHAR); CREATE TABLE hosting_city (host_city VARCHAR, year INTEGER) |
###question:Which city has hosted the most events?###answer:SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY T2.host_city ORDER BY COUNT(*) DESC LIMIT 1###context:CREATE TABLE city (city VARCHAR, city_id VARCHAR); CREATE TABLE hosting_city (host_city VARCHAR) |
###question:What is the venue of the competition "1994 FIFA World Cup qualification" hosted by "Nanjing ( Jiangsu )"?###answer:SELECT T3.venue FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city JOIN MATCH AS T3 ON T2.match_id = T3.match_id WHERE T1.city = "Nanjing ( Jiangsu )" AND T3.competition = "1994 FIFA World Cup qualification"###context:CREATE TABLE city (city_id VARCHAR, city VARCHAR); CREATE TABLE MATCH (venue VARCHAR, match_id VARCHAR, competition VARCHAR); CREATE TABLE hosting_city (host_city VARCHAR, match_id VARCHAR) |
###question:Give me the temperature of Shanghai in January.###answer:SELECT T2.Jan FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T1.city = "Shanghai"###context:CREATE TABLE city (city_id VARCHAR, city VARCHAR); CREATE TABLE temperature (Jan VARCHAR, city_id VARCHAR) |
###question:What is the host year of city "Taizhou ( Zhejiang )"?###answer:SELECT T2.year FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T1.city = "Taizhou ( Zhejiang )"###context:CREATE TABLE city (city_id VARCHAR, city VARCHAR); CREATE TABLE hosting_city (year VARCHAR, host_city VARCHAR) |
###question:Which three cities have the largest regional population?###answer:SELECT city FROM city ORDER BY regional_population DESC LIMIT 3###context:CREATE TABLE city (city VARCHAR, regional_population VARCHAR) |
###question:Which city has the lowest GDP? Please list the city name and its GDP.###answer:SELECT city, GDP FROM city ORDER BY GDP LIMIT 1###context:CREATE TABLE city (city VARCHAR, GDP VARCHAR) |
###question:Which city has the highest temperature in February?###answer:SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id ORDER BY T2.Feb DESC LIMIT 1###context:CREATE TABLE city (city VARCHAR, city_id VARCHAR); CREATE TABLE temperature (city_id VARCHAR, Feb VARCHAR) |
###question:Give me a list of cities whose temperature in March is lower than that in July or higher than that in Oct?###answer:SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul OR T2.Mar > T2.Oct###context:CREATE TABLE city (city VARCHAR, city_id VARCHAR); CREATE TABLE temperature (city_id VARCHAR, Mar VARCHAR, Jul VARCHAR, Oct VARCHAR) |
###question:Give me a list of cities whose temperature in Mar is lower than that in July and which have also served as host cities?###answer:SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul INTERSECT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city###context:CREATE TABLE city (city VARCHAR, city_id VARCHAR); CREATE TABLE hosting_city (host_city VARCHAR); CREATE TABLE temperature (city_id VARCHAR, Mar INTEGER, Jul VARCHAR) |
###question:Give me a list of cities whose temperature in Mar is lower than that in Dec and which have never been host cities.###answer:SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Dec EXCEPT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city###context:CREATE TABLE city (city VARCHAR, city_id VARCHAR); CREATE TABLE hosting_city (host_city VARCHAR); CREATE TABLE temperature (city_id VARCHAR, Mar INTEGER, Dec VARCHAR) |
###question:Give me a list of cities whose temperature in Feb is higher than that in Jun or cities that were once host cities?###answer:SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Feb > T2.Jun UNION SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city###context:CREATE TABLE city (city VARCHAR, city_id VARCHAR); CREATE TABLE hosting_city (host_city VARCHAR); CREATE TABLE temperature (city_id VARCHAR, Feb INTEGER, Jun VARCHAR) |
###question:Please give me a list of cities whose regional population is over 10000000.###answer:SELECT city FROM city WHERE regional_population > 10000000###context:CREATE TABLE city (city VARCHAR, regional_population INTEGER) |
###question:Please give me a list of cities whose regional population is over 8000000 or under 5000000.###answer:SELECT city FROM city WHERE regional_population > 10000000 UNION SELECT city FROM city WHERE regional_population < 5000000###context:CREATE TABLE city (city VARCHAR, regional_population INTEGER) |
###question:Find the number of matches in different competitions.###answer:SELECT COUNT(*), Competition FROM MATCH GROUP BY Competition###context:CREATE TABLE MATCH (Competition VARCHAR) |
###question:List venues of all matches in the order of their dates starting from the most recent one.###answer:SELECT venue FROM MATCH ORDER BY date DESC###context:CREATE TABLE MATCH (venue VARCHAR, date VARCHAR) |
###question:what is the GDP of the city with the largest population.###answer:SELECT gdp FROM city ORDER BY Regional_Population DESC LIMIT 1###context:CREATE TABLE city (gdp VARCHAR, Regional_Population VARCHAR) |
###question:What are the GDP and population of the city that already served as a host more than once?###answer:SELECT t1.gdp, t1.Regional_Population FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY t2.Host_City HAVING COUNT(*) > 1###context:CREATE TABLE hosting_city (host_city VARCHAR); CREATE TABLE city (city_id VARCHAR) |
###question:List every individual's first name, middle name and last name in alphabetical order by last name.###answer:SELECT individual_first_name, individual_middle_name, individual_last_name FROM individuals ORDER BY individual_last_name###context:CREATE TABLE individuals (individual_first_name VARCHAR, individual_middle_name VARCHAR, individual_last_name VARCHAR) |
###question:List all the types of forms.###answer:SELECT DISTINCT form_type_code FROM forms###context:CREATE TABLE forms (form_type_code VARCHAR) |
###question:Find the name of the most popular party form.###answer:SELECT t1.form_name FROM forms AS t1 JOIN party_forms AS t2 ON t1.form_id = t2.form_id GROUP BY t2.form_id ORDER BY COUNT(*) DESC LIMIT 1###context:CREATE TABLE party_forms (form_id VARCHAR); CREATE TABLE forms (form_name VARCHAR, form_id VARCHAR) |
###question:Find the payment method and phone of the party with email "[email protected]".###answer:SELECT payment_method_code, party_phone FROM parties WHERE party_email = "[email protected]"###context:CREATE TABLE parties (payment_method_code VARCHAR, party_phone VARCHAR, party_email VARCHAR) |
###question:Find the emails of parties with the most popular party form.###answer:SELECT t1.party_email FROM parties AS t1 JOIN party_forms AS t2 ON t1.party_id = t2.party_id WHERE t2.form_id = (SELECT form_id FROM party_forms GROUP BY form_id ORDER BY COUNT(*) DESC LIMIT 1)###context:CREATE TABLE party_forms (form_id VARCHAR); CREATE TABLE parties (party_email VARCHAR, party_id VARCHAR); CREATE TABLE party_forms (party_id VARCHAR, form_id VARCHAR) |
###question:List all the name of organizations in order of the date formed.###answer:SELECT organization_name FROM organizations ORDER BY date_formed###context:CREATE TABLE organizations (organization_name VARCHAR, date_formed VARCHAR) |
###question:Find the name of the youngest organization.###answer:SELECT organization_name FROM organizations ORDER BY date_formed DESC LIMIT 1###context:CREATE TABLE organizations (organization_name VARCHAR, date_formed VARCHAR) |
###question:Find the last name of the latest contact individual of the organization "Labour Party".###answer:SELECT t3.individual_last_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id JOIN individuals AS t3 ON t2.individual_id = t3.individual_id WHERE t1.organization_name = "Labour Party" ORDER BY t2.date_contact_to DESC LIMIT 1###context:CREATE TABLE organizations (organization_id VARCHAR, organization_name VARCHAR); CREATE TABLE individuals (individual_last_name VARCHAR, individual_id VARCHAR); CREATE TABLE organization_contact_individuals (organization_id VARCHAR, individual_id VARCHAR, date_contact_to VARCHAR) |
###question:Find the last name of the first ever contact person of the organization with the highest UK Vat number.###answer:SELECT t3.individual_last_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id JOIN individuals AS t3 ON t2.individual_id = t3.individual_id WHERE t1.uk_vat_number = (SELECT MAX(uk_vat_number) FROM organizations) ORDER BY t2.date_contact_to LIMIT 1###context:CREATE TABLE organizations (uk_vat_number INTEGER); CREATE TABLE individuals (individual_last_name VARCHAR, individual_id VARCHAR); CREATE TABLE organizations (organization_id VARCHAR, uk_vat_number INTEGER); CREATE TABLE organization_contact_individuals (organization_id VARCHAR, individual_id VARCHAR, date_contact_to VARCHAR) |
###question:Find name of the services that has never been used.###answer:SELECT service_name FROM services EXCEPT SELECT t1.service_name FROM services AS t1 JOIN party_services AS t2 ON t1.service_id = t2.service_id###context:CREATE TABLE services (service_name VARCHAR); CREATE TABLE party_services (service_id VARCHAR); CREATE TABLE services (service_name VARCHAR, service_id VARCHAR) |
###question:Find the name of all the cities and states.###answer:SELECT town_city FROM addresses UNION SELECT state_province_county FROM addresses###context:CREATE TABLE addresses (town_city VARCHAR, state_province_county VARCHAR) |
###question:How many cities are there in state "Colorado"?###answer:SELECT COUNT(*) FROM addresses WHERE state_province_county = "Colorado"###context:CREATE TABLE addresses (state_province_county VARCHAR) |
###question:Find the payment method code used by more than 3 parties.###answer:SELECT payment_method_code FROM parties GROUP BY payment_method_code HAVING COUNT(*) > 3###context:CREATE TABLE parties (payment_method_code VARCHAR) |
###question:Find the name of organizations whose names contain "Party".###answer:SELECT organization_name FROM organizations WHERE organization_name LIKE "%Party%"###context:CREATE TABLE organizations (organization_name VARCHAR) |
###question:How many distinct payment methods are used by parties?###answer:SELECT COUNT(DISTINCT payment_method_code) FROM parties###context:CREATE TABLE parties (payment_method_code VARCHAR) |
###question:Which is the email of the party that has used the services the most number of times?###answer:SELECT t1.party_email FROM parties AS t1 JOIN party_services AS t2 ON t1.party_id = t2.customer_id GROUP BY t1.party_email ORDER BY COUNT(*) DESC LIMIT 1###context:CREATE TABLE parties (party_email VARCHAR, party_id VARCHAR); CREATE TABLE party_services (customer_id VARCHAR) |
###question:Which state can address "6862 Kaitlyn Knolls" possibly be in?###answer:SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE "%6862 Kaitlyn Knolls%"###context:CREATE TABLE addresses (state_province_county VARCHAR, line_1_number_building VARCHAR) |
###question:What is the name of organization that has the greatest number of contact individuals?###answer:SELECT t1.organization_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id GROUP BY t1.organization_name ORDER BY COUNT(*) DESC LIMIT 1###context:CREATE TABLE organization_contact_individuals (organization_id VARCHAR); CREATE TABLE organizations (organization_name VARCHAR, organization_id VARCHAR) |
###question:Find the last name of the individuals that have been contact individuals of an organization.###answer:SELECT DISTINCT t1.individual_last_name FROM individuals AS t1 JOIN organization_contact_individuals AS t2 ON t1.individual_id = t2.individual_id###context:CREATE TABLE individuals (individual_last_name VARCHAR, individual_id VARCHAR); CREATE TABLE organization_contact_individuals (individual_id VARCHAR) |
###question:How many drivers are there?###answer:SELECT COUNT(*) FROM driver###context:CREATE TABLE driver (Id VARCHAR) |
###question:Show the name, home city, and age for all drivers.###answer:SELECT name, home_city, age FROM driver###context:CREATE TABLE driver (name VARCHAR, home_city VARCHAR, age VARCHAR) |
###question:Show the party and the number of drivers in each party.###answer:SELECT party, COUNT(*) FROM driver GROUP BY party###context:CREATE TABLE driver (party VARCHAR) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.