question
stringlengths 19
224
⌀ | context
stringlengths 30
355
⌀ | answer
stringlengths 20
557
⌀ | input
stringlengths 138
630
| output
stringlengths 20
557
|
---|---|---|---|---|
Show gas station id, location, and manager_name for all gas stations ordered by open year. | CREATE TABLE gas_station (station_id VARCHAR, LOCATION VARCHAR, manager_name VARCHAR, open_year VARCHAR) | SELECT station_id, LOCATION, manager_name FROM gas_station ORDER BY open_year | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE gas_station (station_id VARCHAR, LOCATION VARCHAR, manager_name VARCHAR, open_year VARCHAR)
### question:Show gas station id, location, and manager_name for all gas stations ordered by open year. | SELECT station_id, LOCATION, manager_name FROM gas_station ORDER BY open_year |
How many gas station are opened between 2000 and 2005? | CREATE TABLE gas_station (open_year INTEGER) | SELECT COUNT(*) FROM gas_station WHERE open_year BETWEEN 2000 AND 2005 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE gas_station (open_year INTEGER)
### question:How many gas station are opened between 2000 and 2005? | SELECT COUNT(*) FROM gas_station WHERE open_year BETWEEN 2000 AND 2005 |
Show all locations and the number of gas stations in each location ordered by the count. | CREATE TABLE gas_station (LOCATION VARCHAR) | SELECT LOCATION, COUNT(*) FROM gas_station GROUP BY LOCATION ORDER BY COUNT(*) | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE gas_station (LOCATION VARCHAR)
### question:Show all locations and the number of gas stations in each location ordered by the count. | SELECT LOCATION, COUNT(*) FROM gas_station GROUP BY LOCATION ORDER BY COUNT(*) |
Show all headquarters with both a company in banking industry and a company in Oil and gas. | CREATE TABLE company (headquarters VARCHAR, main_industry VARCHAR) | SELECT headquarters FROM company WHERE main_industry = 'Banking' INTERSECT SELECT headquarters FROM company WHERE main_industry = 'Oil and gas' | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE company (headquarters VARCHAR, main_industry VARCHAR)
### question:Show all headquarters with both a company in banking industry and a company in Oil and gas. | SELECT headquarters FROM company WHERE main_industry = 'Banking' INTERSECT SELECT headquarters FROM company WHERE main_industry = 'Oil and gas' |
Show all headquarters without a company in banking industry. | CREATE TABLE company (headquarters VARCHAR, main_industry VARCHAR) | SELECT headquarters FROM company EXCEPT SELECT headquarters FROM company WHERE main_industry = 'Banking' | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE company (headquarters VARCHAR, main_industry VARCHAR)
### question:Show all headquarters without a company in banking industry. | SELECT headquarters FROM company EXCEPT SELECT headquarters FROM company WHERE main_industry = 'Banking' |
Show the company name with the number of gas station. | CREATE TABLE station_company (company_id VARCHAR); CREATE TABLE company (company VARCHAR, company_id VARCHAR) | SELECT T2.company, COUNT(*) FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE station_company (company_id VARCHAR); CREATE TABLE company (company VARCHAR, company_id VARCHAR)
### question:Show the company name with the number of gas station. | SELECT T2.company, COUNT(*) FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id |
Show company name and main industry without a gas station. | CREATE TABLE station_company (company VARCHAR, main_industry VARCHAR, company_id VARCHAR); CREATE TABLE company (company VARCHAR, main_industry VARCHAR, company_id VARCHAR) | SELECT company, main_industry FROM company WHERE NOT company_id IN (SELECT company_id FROM station_company) | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE station_company (company VARCHAR, main_industry VARCHAR, company_id VARCHAR); CREATE TABLE company (company VARCHAR, main_industry VARCHAR, company_id VARCHAR)
### question:Show company name and main industry without a gas station. | SELECT company, main_industry FROM company WHERE NOT company_id IN (SELECT company_id FROM station_company) |
Show the manager name for gas stations belonging to the ExxonMobil company. | CREATE TABLE gas_station (manager_name VARCHAR, station_id VARCHAR); CREATE TABLE station_company (company_id VARCHAR, station_id VARCHAR); CREATE TABLE company (company_id VARCHAR, company VARCHAR) | SELECT T3.manager_name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.company = 'ExxonMobil' | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE gas_station (manager_name VARCHAR, station_id VARCHAR); CREATE TABLE station_company (company_id VARCHAR, station_id VARCHAR); CREATE TABLE company (company_id VARCHAR, company VARCHAR)
### question:Show the manager name for gas stations belonging to the ExxonMobil company. | SELECT T3.manager_name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.company = 'ExxonMobil' |
Show all locations where a gas station for company with market value greater than 100 is located. | CREATE TABLE gas_station (location VARCHAR, station_id VARCHAR); CREATE TABLE company (company_id VARCHAR, market_value INTEGER); CREATE TABLE station_company (company_id VARCHAR, station_id VARCHAR) | SELECT T3.location FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.market_value > 100 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE gas_station (location VARCHAR, station_id VARCHAR); CREATE TABLE company (company_id VARCHAR, market_value INTEGER); CREATE TABLE station_company (company_id VARCHAR, station_id VARCHAR)
### question:Show all locations where a gas station for company with market value greater than 100 is located. | SELECT T3.location FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id WHERE T2.market_value > 100 |
Show the manager name with most number of gas stations opened after 2000. | CREATE TABLE gas_station (manager_name VARCHAR, open_year INTEGER) | SELECT manager_name FROM gas_station WHERE open_year > 2000 GROUP BY manager_name ORDER BY COUNT(*) DESC LIMIT 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE gas_station (manager_name VARCHAR, open_year INTEGER)
### question:Show the manager name with most number of gas stations opened after 2000. | SELECT manager_name FROM gas_station WHERE open_year > 2000 GROUP BY manager_name ORDER BY COUNT(*) DESC LIMIT 1 |
order all gas station locations by the opening year. | CREATE TABLE gas_station (LOCATION VARCHAR, open_year VARCHAR) | SELECT LOCATION FROM gas_station ORDER BY open_year | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE gas_station (LOCATION VARCHAR, open_year VARCHAR)
### question:order all gas station locations by the opening year. | SELECT LOCATION FROM gas_station ORDER BY open_year |
find the rank, company names, market values of the companies in the banking industry order by their sales and profits in billion. | CREATE TABLE company (rank VARCHAR, company VARCHAR, market_value VARCHAR, main_industry VARCHAR, sales_billion VARCHAR, profits_billion VARCHAR) | SELECT rank, company, market_value FROM company WHERE main_industry = 'Banking' ORDER BY sales_billion, profits_billion | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE company (rank VARCHAR, company VARCHAR, market_value VARCHAR, main_industry VARCHAR, sales_billion VARCHAR, profits_billion VARCHAR)
### question:find the rank, company names, market values of the companies in the banking industry order by their sales and profits in billion. | SELECT rank, company, market_value FROM company WHERE main_industry = 'Banking' ORDER BY sales_billion, profits_billion |
find the location and Representative name of the gas stations owned by the companies with top 3 Asset amounts. | CREATE TABLE gas_station (location VARCHAR, Representative_Name VARCHAR, station_id VARCHAR); CREATE TABLE station_company (company_id VARCHAR, station_id VARCHAR); CREATE TABLE company (company_id VARCHAR, Assets_billion VARCHAR) | SELECT T3.location, T3.Representative_Name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id ORDER BY T2.Assets_billion DESC LIMIT 3 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE gas_station (location VARCHAR, Representative_Name VARCHAR, station_id VARCHAR); CREATE TABLE station_company (company_id VARCHAR, station_id VARCHAR); CREATE TABLE company (company_id VARCHAR, Assets_billion VARCHAR)
### question:find the location and Representative name of the gas stations owned by the companies with top 3 Asset amounts. | SELECT T3.location, T3.Representative_Name FROM station_company AS T1 JOIN company AS T2 ON T1.company_id = T2.company_id JOIN gas_station AS T3 ON T1.station_id = T3.station_id ORDER BY T2.Assets_billion DESC LIMIT 3 |
How many regions do we have? | CREATE TABLE region (Id VARCHAR) | SELECT COUNT(*) FROM region | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE region (Id VARCHAR)
### question:How many regions do we have? | SELECT COUNT(*) FROM region |
Show all distinct region names ordered by their labels. | CREATE TABLE region (region_name VARCHAR, Label VARCHAR) | SELECT DISTINCT region_name FROM region ORDER BY Label | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE region (region_name VARCHAR, Label VARCHAR)
### question:Show all distinct region names ordered by their labels. | SELECT DISTINCT region_name FROM region ORDER BY Label |
How many parties do we have? | CREATE TABLE party (party_name VARCHAR) | SELECT COUNT(DISTINCT party_name) FROM party | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party (party_name VARCHAR)
### question:How many parties do we have? | SELECT COUNT(DISTINCT party_name) FROM party |
Show the ministers and the time they took and left office, listed by the time they left office. | CREATE TABLE party (minister VARCHAR, took_office VARCHAR, left_office VARCHAR) | SELECT minister, took_office, left_office FROM party ORDER BY left_office | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party (minister VARCHAR, took_office VARCHAR, left_office VARCHAR)
### question:Show the ministers and the time they took and left office, listed by the time they left office. | SELECT minister, took_office, left_office FROM party ORDER BY left_office |
Show the minister who took office after 1961 or before 1959. | CREATE TABLE party (minister VARCHAR, took_office VARCHAR) | SELECT minister FROM party WHERE took_office > 1961 OR took_office < 1959 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party (minister VARCHAR, took_office VARCHAR)
### question:Show the minister who took office after 1961 or before 1959. | SELECT minister FROM party WHERE took_office > 1961 OR took_office < 1959 |
Show all ministers who do not belong to Progress Party. | CREATE TABLE party (minister VARCHAR, party_name VARCHAR) | SELECT minister FROM party WHERE party_name <> 'Progress Party' | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party (minister VARCHAR, party_name VARCHAR)
### question:Show all ministers who do not belong to Progress Party. | SELECT minister FROM party WHERE party_name <> 'Progress Party' |
Show all ministers and parties they belong to in descending order of the time they took office. | CREATE TABLE party (minister VARCHAR, party_name VARCHAR, took_office VARCHAR) | SELECT minister, party_name FROM party ORDER BY took_office DESC | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party (minister VARCHAR, party_name VARCHAR, took_office VARCHAR)
### question:Show all ministers and parties they belong to in descending order of the time they took office. | SELECT minister, party_name FROM party ORDER BY took_office DESC |
Return the minister who left office at the latest time. | CREATE TABLE party (minister VARCHAR, left_office VARCHAR) | SELECT minister FROM party ORDER BY left_office DESC LIMIT 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party (minister VARCHAR, left_office VARCHAR)
### question:Return the minister who left office at the latest time. | SELECT minister FROM party ORDER BY left_office DESC LIMIT 1 |
List member names and their party names. | CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE Member (member_name VARCHAR, party_id VARCHAR) | SELECT T1.member_name, T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE Member (member_name VARCHAR, party_id VARCHAR)
### question:List member names and their party names. | SELECT T1.member_name, T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id |
Show all party names and the number of members in each party. | CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE Member (party_id VARCHAR) | SELECT T2.party_name, COUNT(*) FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE Member (party_id VARCHAR)
### question:Show all party names and the number of members in each party. | SELECT T2.party_name, COUNT(*) FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id |
What is the name of party with most number of members? | CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE Member (party_id VARCHAR) | SELECT T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id ORDER BY COUNT(*) DESC LIMIT 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE Member (party_id VARCHAR)
### question:What is the name of party with most number of members? | SELECT T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id ORDER BY COUNT(*) DESC LIMIT 1 |
Show all party names and their region names. | CREATE TABLE region (region_name VARCHAR, region_id VARCHAR); CREATE TABLE party (party_name VARCHAR, region_id VARCHAR) | SELECT T1.party_name, T2.region_name FROM party AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE region (region_name VARCHAR, region_id VARCHAR); CREATE TABLE party (party_name VARCHAR, region_id VARCHAR)
### question:Show all party names and their region names. | SELECT T1.party_name, T2.region_name FROM party AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id |
Show names of parties that does not have any members. | CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE Member (party_name VARCHAR, party_id VARCHAR) | SELECT party_name FROM party WHERE NOT party_id IN (SELECT party_id FROM Member) | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE Member (party_name VARCHAR, party_id VARCHAR)
### question:Show names of parties that does not have any members. | SELECT party_name FROM party WHERE NOT party_id IN (SELECT party_id FROM Member) |
Show the member names which are in both the party with id 3 and the party with id 1. | CREATE TABLE member (member_name VARCHAR, party_id VARCHAR) | SELECT member_name FROM member WHERE party_id = 3 INTERSECT SELECT member_name FROM member WHERE party_id = 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE member (member_name VARCHAR, party_id VARCHAR)
### question:Show the member names which are in both the party with id 3 and the party with id 1. | SELECT member_name FROM member WHERE party_id = 3 INTERSECT SELECT member_name FROM member WHERE party_id = 1 |
Show member names that are not in the Progress Party. | CREATE TABLE party (party_id VARCHAR, Party_name VARCHAR); CREATE TABLE Member (member_name VARCHAR, party_id VARCHAR) | SELECT T1.member_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id WHERE T2.Party_name <> "Progress Party" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party (party_id VARCHAR, Party_name VARCHAR); CREATE TABLE Member (member_name VARCHAR, party_id VARCHAR)
### question:Show member names that are not in the Progress Party. | SELECT T1.member_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id WHERE T2.Party_name <> "Progress Party" |
How many party events do we have? | CREATE TABLE party_events (Id VARCHAR) | SELECT COUNT(*) FROM party_events | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party_events (Id VARCHAR)
### question:How many party events do we have? | SELECT COUNT(*) FROM party_events |
Show party names and the number of events for each party. | CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE party_events (party_id VARCHAR) | SELECT T2.party_name, COUNT(*) FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE party_events (party_id VARCHAR)
### question:Show party names and the number of events for each party. | SELECT T2.party_name, COUNT(*) FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id |
Show all member names who are not in charge of any event. | CREATE TABLE member (member_name VARCHAR); CREATE TABLE party_events (member_in_charge_id VARCHAR); CREATE TABLE member (member_name VARCHAR, member_id VARCHAR) | SELECT member_name FROM member EXCEPT SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE member (member_name VARCHAR); CREATE TABLE party_events (member_in_charge_id VARCHAR); CREATE TABLE member (member_name VARCHAR, member_id VARCHAR)
### question:Show all member names who are not in charge of any event. | SELECT member_name FROM member EXCEPT SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id |
What are the names of parties with at least 2 events? | CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE party_events (party_id VARCHAR) | SELECT T2.party_name FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id HAVING COUNT(*) >= 2 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party (party_name VARCHAR, party_id VARCHAR); CREATE TABLE party_events (party_id VARCHAR)
### question:What are the names of parties with at least 2 events? | SELECT T2.party_name FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id HAVING COUNT(*) >= 2 |
What is the name of member in charge of greatest number of events? | CREATE TABLE party_events (member_in_charge_id VARCHAR); CREATE TABLE member (member_name VARCHAR, member_id VARCHAR) | SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id GROUP BY T2.member_in_charge_id ORDER BY COUNT(*) DESC LIMIT 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party_events (member_in_charge_id VARCHAR); CREATE TABLE member (member_name VARCHAR, member_id VARCHAR)
### question:What is the name of member in charge of greatest number of events? | SELECT T1.member_name FROM member AS T1 JOIN party_events AS T2 ON T1.member_id = T2.member_in_charge_id GROUP BY T2.member_in_charge_id ORDER BY COUNT(*) DESC LIMIT 1 |
find the event names that have more than 2 records. | CREATE TABLE party_events (event_name VARCHAR) | SELECT event_name FROM party_events GROUP BY event_name HAVING COUNT(*) > 2 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party_events (event_name VARCHAR)
### question:find the event names that have more than 2 records. | SELECT event_name FROM party_events GROUP BY event_name HAVING COUNT(*) > 2 |
How many Annual Meeting events happened in the United Kingdom region? | CREATE TABLE party_events (party_id VARCHAR, Event_Name VARCHAR); CREATE TABLE region (region_id VARCHAR, region_name VARCHAR); CREATE TABLE party (region_id VARCHAR, party_id VARCHAR) | SELECT COUNT(*) FROM region AS t1 JOIN party AS t2 ON t1.region_id = t2.region_id JOIN party_events AS t3 ON t2.party_id = t3.party_id WHERE t1.region_name = "United Kingdom" AND t3.Event_Name = "Annaual Meeting" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE party_events (party_id VARCHAR, Event_Name VARCHAR); CREATE TABLE region (region_id VARCHAR, region_name VARCHAR); CREATE TABLE party (region_id VARCHAR, party_id VARCHAR)
### question:How many Annual Meeting events happened in the United Kingdom region? | SELECT COUNT(*) FROM region AS t1 JOIN party AS t2 ON t1.region_id = t2.region_id JOIN party_events AS t3 ON t2.party_id = t3.party_id WHERE t1.region_name = "United Kingdom" AND t3.Event_Name = "Annaual Meeting" |
How many pilots are there? | CREATE TABLE pilot (Id VARCHAR) | SELECT COUNT(*) FROM pilot | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE pilot (Id VARCHAR)
### question:How many pilots are there? | SELECT COUNT(*) FROM pilot |
List the names of pilots in ascending order of rank. | CREATE TABLE pilot (Pilot_name VARCHAR, Rank VARCHAR) | SELECT Pilot_name FROM pilot ORDER BY Rank | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE pilot (Pilot_name VARCHAR, Rank VARCHAR)
### question:List the names of pilots in ascending order of rank. | SELECT Pilot_name FROM pilot ORDER BY Rank |
What are the positions and teams of pilots? | CREATE TABLE pilot (POSITION VARCHAR, Team VARCHAR) | SELECT POSITION, Team FROM pilot | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE pilot (POSITION VARCHAR, Team VARCHAR)
### question:What are the positions and teams of pilots? | SELECT POSITION, Team FROM pilot |
List the distinct positions of pilots older than 30. | CREATE TABLE pilot (POSITION VARCHAR, Age INTEGER) | SELECT DISTINCT POSITION FROM pilot WHERE Age > 30 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE pilot (POSITION VARCHAR, Age INTEGER)
### question:List the distinct positions of pilots older than 30. | SELECT DISTINCT POSITION FROM pilot WHERE Age > 30 |
Show the names of pilots from team "Bradley" or "Fordham". | CREATE TABLE pilot (Pilot_name VARCHAR, Team VARCHAR) | SELECT Pilot_name FROM pilot WHERE Team = "Bradley" OR Team = "Fordham" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE pilot (Pilot_name VARCHAR, Team VARCHAR)
### question:Show the names of pilots from team "Bradley" or "Fordham". | SELECT Pilot_name FROM pilot WHERE Team = "Bradley" OR Team = "Fordham" |
What is the joined year of the pilot of the highest rank? | CREATE TABLE pilot (Join_Year VARCHAR, Rank VARCHAR) | SELECT Join_Year FROM pilot ORDER BY Rank LIMIT 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE pilot (Join_Year VARCHAR, Rank VARCHAR)
### question:What is the joined year of the pilot of the highest rank? | SELECT Join_Year FROM pilot ORDER BY Rank LIMIT 1 |
What are the different nationalities of pilots? Show each nationality and the number of pilots of each nationality. | CREATE TABLE pilot (Nationality VARCHAR) | SELECT Nationality, COUNT(*) FROM pilot GROUP BY Nationality | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE pilot (Nationality VARCHAR)
### question:What are the different nationalities of pilots? Show each nationality and the number of pilots of each nationality. | SELECT Nationality, COUNT(*) FROM pilot GROUP BY Nationality |
Show the most common nationality of pilots. | CREATE TABLE pilot (Nationality VARCHAR) | SELECT Nationality FROM pilot GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE pilot (Nationality VARCHAR)
### question:Show the most common nationality of pilots. | SELECT Nationality FROM pilot GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1 |
Show the pilot positions that have both pilots joining after year 2005 and pilots joining before 2000. | CREATE TABLE pilot (POSITION VARCHAR, Join_Year INTEGER) | SELECT POSITION FROM pilot WHERE Join_Year < 2000 INTERSECT SELECT POSITION FROM pilot WHERE Join_Year > 2005 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE pilot (POSITION VARCHAR, Join_Year INTEGER)
### question:Show the pilot positions that have both pilots joining after year 2005 and pilots joining before 2000. | SELECT POSITION FROM pilot WHERE Join_Year < 2000 INTERSECT SELECT POSITION FROM pilot WHERE Join_Year > 2005 |
Show the names of pilots and models of aircrafts they have flied with. | CREATE TABLE pilot_record (Aircraft_ID VARCHAR, Pilot_ID VARCHAR); CREATE TABLE pilot (Pilot_name VARCHAR, Pilot_ID VARCHAR); CREATE TABLE aircraft (Model VARCHAR, Aircraft_ID VARCHAR) | SELECT T3.Pilot_name, T2.Model FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE pilot_record (Aircraft_ID VARCHAR, Pilot_ID VARCHAR); CREATE TABLE pilot (Pilot_name VARCHAR, Pilot_ID VARCHAR); CREATE TABLE aircraft (Model VARCHAR, Aircraft_ID VARCHAR)
### question:Show the names of pilots and models of aircrafts they have flied with. | SELECT T3.Pilot_name, T2.Model FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID |
Show the names of pilots and fleet series of the aircrafts they have flied with in ascending order of the rank of the pilot. | CREATE TABLE pilot (Pilot_name VARCHAR, Pilot_ID VARCHAR, Rank VARCHAR); CREATE TABLE pilot_record (Aircraft_ID VARCHAR, Pilot_ID VARCHAR); CREATE TABLE aircraft (Fleet_Series VARCHAR, Aircraft_ID VARCHAR) | SELECT T3.Pilot_name, T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID ORDER BY T3.Rank | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE pilot (Pilot_name VARCHAR, Pilot_ID VARCHAR, Rank VARCHAR); CREATE TABLE pilot_record (Aircraft_ID VARCHAR, Pilot_ID VARCHAR); CREATE TABLE aircraft (Fleet_Series VARCHAR, Aircraft_ID VARCHAR)
### question:Show the names of pilots and fleet series of the aircrafts they have flied with in ascending order of the rank of the pilot. | SELECT T3.Pilot_name, T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID ORDER BY T3.Rank |
Show the fleet series of the aircrafts flied by pilots younger than 34 | CREATE TABLE pilot_record (Aircraft_ID VARCHAR, Pilot_ID VARCHAR); CREATE TABLE pilot (Pilot_ID VARCHAR, Age INTEGER); CREATE TABLE aircraft (Fleet_Series VARCHAR, Aircraft_ID VARCHAR) | SELECT T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID WHERE T3.Age < 34 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE pilot_record (Aircraft_ID VARCHAR, Pilot_ID VARCHAR); CREATE TABLE pilot (Pilot_ID VARCHAR, Age INTEGER); CREATE TABLE aircraft (Fleet_Series VARCHAR, Aircraft_ID VARCHAR)
### question:Show the fleet series of the aircrafts flied by pilots younger than 34 | SELECT T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID WHERE T3.Age < 34 |
Show the names of pilots and the number of records they have. | CREATE TABLE pilot (Pilot_name VARCHAR, pilot_ID VARCHAR); CREATE TABLE pilot_record (pilot_ID VARCHAR) | SELECT T2.Pilot_name, COUNT(*) FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.pilot_ID = T2.pilot_ID GROUP BY T2.Pilot_name | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE pilot (Pilot_name VARCHAR, pilot_ID VARCHAR); CREATE TABLE pilot_record (pilot_ID VARCHAR)
### question:Show the names of pilots and the number of records they have. | SELECT T2.Pilot_name, COUNT(*) FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.pilot_ID = T2.pilot_ID GROUP BY T2.Pilot_name |
Show names of pilots that have more than one record. | CREATE TABLE pilot (Pilot_name VARCHAR, pilot_ID VARCHAR); CREATE TABLE pilot_record (pilot_ID VARCHAR) | SELECT T2.Pilot_name, COUNT(*) FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.pilot_ID = T2.pilot_ID GROUP BY T2.Pilot_name HAVING COUNT(*) > 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE pilot (Pilot_name VARCHAR, pilot_ID VARCHAR); CREATE TABLE pilot_record (pilot_ID VARCHAR)
### question:Show names of pilots that have more than one record. | SELECT T2.Pilot_name, COUNT(*) FROM pilot_record AS T1 JOIN pilot AS T2 ON T1.pilot_ID = T2.pilot_ID GROUP BY T2.Pilot_name HAVING COUNT(*) > 1 |
List the names of pilots that do not have any record. | CREATE TABLE pilot_record (Pilot_name VARCHAR, Pilot_ID VARCHAR); CREATE TABLE pilot (Pilot_name VARCHAR, Pilot_ID VARCHAR) | SELECT Pilot_name FROM pilot WHERE NOT Pilot_ID IN (SELECT Pilot_ID FROM pilot_record) | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE pilot_record (Pilot_name VARCHAR, Pilot_ID VARCHAR); CREATE TABLE pilot (Pilot_name VARCHAR, Pilot_ID VARCHAR)
### question:List the names of pilots that do not have any record. | SELECT Pilot_name FROM pilot WHERE NOT Pilot_ID IN (SELECT Pilot_ID FROM pilot_record) |
What document status codes do we have? | CREATE TABLE Ref_Document_Status (document_status_code VARCHAR) | SELECT document_status_code FROM Ref_Document_Status | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Ref_Document_Status (document_status_code VARCHAR)
### question:What document status codes do we have? | SELECT document_status_code FROM Ref_Document_Status |
What is the description of document status code 'working'? | CREATE TABLE Ref_Document_Status (document_status_description VARCHAR, document_status_code VARCHAR) | SELECT document_status_description FROM Ref_Document_Status WHERE document_status_code = "working" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Ref_Document_Status (document_status_description VARCHAR, document_status_code VARCHAR)
### question:What is the description of document status code 'working'? | SELECT document_status_description FROM Ref_Document_Status WHERE document_status_code = "working" |
What document type codes do we have? | CREATE TABLE Ref_Document_Types (document_type_code VARCHAR) | SELECT document_type_code FROM Ref_Document_Types | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Ref_Document_Types (document_type_code VARCHAR)
### question:What document type codes do we have? | SELECT document_type_code FROM Ref_Document_Types |
What is the description of document type 'Paper'? | CREATE TABLE Ref_Document_Types (document_type_description VARCHAR, document_type_code VARCHAR) | SELECT document_type_description FROM Ref_Document_Types WHERE document_type_code = "Paper" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Ref_Document_Types (document_type_description VARCHAR, document_type_code VARCHAR)
### question:What is the description of document type 'Paper'? | SELECT document_type_description FROM Ref_Document_Types WHERE document_type_code = "Paper" |
What are the shipping agent names? | CREATE TABLE Ref_Shipping_Agents (shipping_agent_name VARCHAR) | SELECT shipping_agent_name FROM Ref_Shipping_Agents | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Ref_Shipping_Agents (shipping_agent_name VARCHAR)
### question:What are the shipping agent names? | SELECT shipping_agent_name FROM Ref_Shipping_Agents |
What is the shipping agent code of shipping agent UPS? | CREATE TABLE Ref_Shipping_Agents (shipping_agent_code VARCHAR, shipping_agent_name VARCHAR) | SELECT shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_name = "UPS" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Ref_Shipping_Agents (shipping_agent_code VARCHAR, shipping_agent_name VARCHAR)
### question:What is the shipping agent code of shipping agent UPS? | SELECT shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_name = "UPS" |
What are all role codes? | CREATE TABLE ROLES (role_code VARCHAR) | SELECT role_code FROM ROLES | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE ROLES (role_code VARCHAR)
### question:What are all role codes? | SELECT role_code FROM ROLES |
What is the description of role code ED? | CREATE TABLE ROLES (role_description VARCHAR, role_code VARCHAR) | SELECT role_description FROM ROLES WHERE role_code = "ED" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE ROLES (role_description VARCHAR, role_code VARCHAR)
### question:What is the description of role code ED? | SELECT role_description FROM ROLES WHERE role_code = "ED" |
How many employees do we have? | CREATE TABLE Employees (Id VARCHAR) | SELECT COUNT(*) FROM Employees | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Employees (Id VARCHAR)
### question:How many employees do we have? | SELECT COUNT(*) FROM Employees |
What is the role of the employee named Koby? | CREATE TABLE ROLES (role_description VARCHAR, role_code VARCHAR); CREATE TABLE Employees (role_code VARCHAR, employee_name VARCHAR) | SELECT T1.role_description FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code WHERE T2.employee_name = "Koby" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE ROLES (role_description VARCHAR, role_code VARCHAR); CREATE TABLE Employees (role_code VARCHAR, employee_name VARCHAR)
### question:What is the role of the employee named Koby? | SELECT T1.role_description FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code WHERE T2.employee_name = "Koby" |
List all document ids and receipt dates of documents. | CREATE TABLE Documents (document_id VARCHAR, receipt_date VARCHAR) | SELECT document_id, receipt_date FROM Documents | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Documents (document_id VARCHAR, receipt_date VARCHAR)
### question:List all document ids and receipt dates of documents. | SELECT document_id, receipt_date FROM Documents |
How many employees does each role have? List role description, id and number of employees. | CREATE TABLE ROLES (role_description VARCHAR, role_code VARCHAR); CREATE TABLE Employees (role_code VARCHAR) | SELECT T1.role_description, T2.role_code, COUNT(*) FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code GROUP BY T2.role_code | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE ROLES (role_description VARCHAR, role_code VARCHAR); CREATE TABLE Employees (role_code VARCHAR)
### question:How many employees does each role have? List role description, id and number of employees. | SELECT T1.role_description, T2.role_code, COUNT(*) FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code GROUP BY T2.role_code |
List roles that have more than one employee. List the role description and number of employees. | CREATE TABLE ROLES (Id VARCHAR); CREATE TABLE Employees (Id VARCHAR) | SELECT Roles.role_description, COUNT(Employees.employee_id) FROM ROLES JOIN Employees ON Employees.role_code = Roles.role_code GROUP BY Employees.role_code HAVING COUNT(Employees.employee_id) > 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE ROLES (Id VARCHAR); CREATE TABLE Employees (Id VARCHAR)
### question:List roles that have more than one employee. List the role description and number of employees. | SELECT Roles.role_description, COUNT(Employees.employee_id) FROM ROLES JOIN Employees ON Employees.role_code = Roles.role_code GROUP BY Employees.role_code HAVING COUNT(Employees.employee_id) > 1 |
What is the document status description of the document with id 1? | CREATE TABLE Documents (Id VARCHAR); CREATE TABLE Ref_Document_Status (Id VARCHAR) | SELECT Ref_Document_Status.document_status_description FROM Ref_Document_Status JOIN Documents ON Documents.document_status_code = Ref_Document_Status.document_status_code WHERE Documents.document_id = 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Documents (Id VARCHAR); CREATE TABLE Ref_Document_Status (Id VARCHAR)
### question:What is the document status description of the document with id 1? | SELECT Ref_Document_Status.document_status_description FROM Ref_Document_Status JOIN Documents ON Documents.document_status_code = Ref_Document_Status.document_status_code WHERE Documents.document_id = 1 |
How many documents have the status code done? | CREATE TABLE Documents (document_status_code VARCHAR) | SELECT COUNT(*) FROM Documents WHERE document_status_code = "done" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Documents (document_status_code VARCHAR)
### question:How many documents have the status code done? | SELECT COUNT(*) FROM Documents WHERE document_status_code = "done" |
List the document type code for the document with the id 2. | CREATE TABLE Documents (document_type_code VARCHAR, document_id VARCHAR) | SELECT document_type_code FROM Documents WHERE document_id = 2 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Documents (document_type_code VARCHAR, document_id VARCHAR)
### question:List the document type code for the document with the id 2. | SELECT document_type_code FROM Documents WHERE document_id = 2 |
List the document ids for any documents with the status code done and the type code paper. | CREATE TABLE Documents (document_id VARCHAR, document_status_code VARCHAR, document_type_code VARCHAR) | SELECT document_id FROM Documents WHERE document_status_code = "done" AND document_type_code = "Paper" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Documents (document_id VARCHAR, document_status_code VARCHAR, document_type_code VARCHAR)
### question:List the document ids for any documents with the status code done and the type code paper. | SELECT document_id FROM Documents WHERE document_status_code = "done" AND document_type_code = "Paper" |
What is the name of the shipping agent of the document with id 2? | CREATE TABLE Documents (Id VARCHAR); CREATE TABLE Ref_Shipping_Agents (Id VARCHAR) | SELECT Ref_Shipping_Agents.shipping_agent_name FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Documents.document_id = 2 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Documents (Id VARCHAR); CREATE TABLE Ref_Shipping_Agents (Id VARCHAR)
### question:What is the name of the shipping agent of the document with id 2? | SELECT Ref_Shipping_Agents.shipping_agent_name FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Documents.document_id = 2 |
How many documents were shipped by USPS? | CREATE TABLE Documents (Id VARCHAR); CREATE TABLE Ref_Shipping_Agents (Id VARCHAR) | SELECT COUNT(*) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = "USPS" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Documents (Id VARCHAR); CREATE TABLE Ref_Shipping_Agents (Id VARCHAR)
### question:How many documents were shipped by USPS? | SELECT COUNT(*) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = "USPS" |
Which shipping agent shipped the most documents? List the shipping agent name and the number of documents. | CREATE TABLE Documents (Id VARCHAR); CREATE TABLE Ref_Shipping_Agents (Id VARCHAR) | SELECT Ref_Shipping_Agents.shipping_agent_name, COUNT(Documents.document_id) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code GROUP BY Ref_Shipping_Agents.shipping_agent_code ORDER BY COUNT(Documents.document_id) DESC LIMIT 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Documents (Id VARCHAR); CREATE TABLE Ref_Shipping_Agents (Id VARCHAR)
### question:Which shipping agent shipped the most documents? List the shipping agent name and the number of documents. | SELECT Ref_Shipping_Agents.shipping_agent_name, COUNT(Documents.document_id) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code GROUP BY Ref_Shipping_Agents.shipping_agent_code ORDER BY COUNT(Documents.document_id) DESC LIMIT 1 |
What is the receipt date of the document with id 3? | CREATE TABLE Documents (receipt_date VARCHAR, document_id VARCHAR) | SELECT receipt_date FROM Documents WHERE document_id = 3 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Documents (receipt_date VARCHAR, document_id VARCHAR)
### question:What is the receipt date of the document with id 3? | SELECT receipt_date FROM Documents WHERE document_id = 3 |
What address was the document with id 4 mailed to? | CREATE TABLE Addresses (document_id VARCHAR); CREATE TABLE Documents_Mailed (document_id VARCHAR) | SELECT Addresses.address_details FROM Addresses JOIN Documents_Mailed ON Documents_Mailed.mailed_to_address_id = Addresses.address_id WHERE document_id = 4 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Addresses (document_id VARCHAR); CREATE TABLE Documents_Mailed (document_id VARCHAR)
### question:What address was the document with id 4 mailed to? | SELECT Addresses.address_details FROM Addresses JOIN Documents_Mailed ON Documents_Mailed.mailed_to_address_id = Addresses.address_id WHERE document_id = 4 |
What is the mail date of the document with id 7? | CREATE TABLE Documents_Mailed (mailing_date VARCHAR, document_id VARCHAR) | SELECT mailing_date FROM Documents_Mailed WHERE document_id = 7 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Documents_Mailed (mailing_date VARCHAR, document_id VARCHAR)
### question:What is the mail date of the document with id 7? | SELECT mailing_date FROM Documents_Mailed WHERE document_id = 7 |
List the document ids of documents with the status done and type Paper, which not shipped by the shipping agent named USPS. | CREATE TABLE Ref_Shipping_Agents (document_id VARCHAR, document_status_code VARCHAR, document_type_code VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_status_code VARCHAR, document_type_code VARCHAR) | SELECT document_id FROM Documents WHERE document_status_code = "done" AND document_type_code = "Paper" EXCEPT SELECT document_id FROM Documents JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = "USPS" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Ref_Shipping_Agents (document_id VARCHAR, document_status_code VARCHAR, document_type_code VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_status_code VARCHAR, document_type_code VARCHAR)
### question:List the document ids of documents with the status done and type Paper, which not shipped by the shipping agent named USPS. | SELECT document_id FROM Documents WHERE document_status_code = "done" AND document_type_code = "Paper" EXCEPT SELECT document_id FROM Documents JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = "USPS" |
List document id of documents status is done and document type is Paper and the document is shipped by shipping agent named USPS. | CREATE TABLE Ref_Shipping_Agents (document_id VARCHAR, document_status_code VARCHAR, document_type_code VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_status_code VARCHAR, document_type_code VARCHAR) | SELECT document_id FROM Documents WHERE document_status_code = "done" AND document_type_code = "Paper" INTERSECT SELECT document_id FROM Documents JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = "USPS" | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Ref_Shipping_Agents (document_id VARCHAR, document_status_code VARCHAR, document_type_code VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_status_code VARCHAR, document_type_code VARCHAR)
### question:List document id of documents status is done and document type is Paper and the document is shipped by shipping agent named USPS. | SELECT document_id FROM Documents WHERE document_status_code = "done" AND document_type_code = "Paper" INTERSECT SELECT document_id FROM Documents JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = "USPS" |
What is draft detail of the document with id 7? | CREATE TABLE Document_Drafts (draft_details VARCHAR, document_id VARCHAR) | SELECT draft_details FROM Document_Drafts WHERE document_id = 7 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Document_Drafts (draft_details VARCHAR, document_id VARCHAR)
### question:What is draft detail of the document with id 7? | SELECT draft_details FROM Document_Drafts WHERE document_id = 7 |
How many draft copies does the document with id 2 have? | CREATE TABLE Draft_Copies (document_id VARCHAR) | SELECT COUNT(*) FROM Draft_Copies WHERE document_id = 2 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Draft_Copies (document_id VARCHAR)
### question:How many draft copies does the document with id 2 have? | SELECT COUNT(*) FROM Draft_Copies WHERE document_id = 2 |
Which document has the most draft copies? List its document id and number of draft copies. | CREATE TABLE Draft_Copies (document_id VARCHAR, copy_number VARCHAR) | SELECT document_id, COUNT(copy_number) FROM Draft_Copies GROUP BY document_id ORDER BY COUNT(copy_number) DESC LIMIT 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Draft_Copies (document_id VARCHAR, copy_number VARCHAR)
### question:Which document has the most draft copies? List its document id and number of draft copies. | SELECT document_id, COUNT(copy_number) FROM Draft_Copies GROUP BY document_id ORDER BY COUNT(copy_number) DESC LIMIT 1 |
Which documents have more than 1 draft copies? List document id and number of draft copies. | CREATE TABLE Draft_Copies (document_id VARCHAR) | SELECT document_id, COUNT(*) FROM Draft_Copies GROUP BY document_id HAVING COUNT(*) > 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Draft_Copies (document_id VARCHAR)
### question:Which documents have more than 1 draft copies? List document id and number of draft copies. | SELECT document_id, COUNT(*) FROM Draft_Copies GROUP BY document_id HAVING COUNT(*) > 1 |
List all employees in the circulation history of the document with id 1. List the employee's name. | CREATE TABLE Circulation_History (Id VARCHAR); CREATE TABLE Employees (Id VARCHAR) | SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id WHERE Circulation_History.document_id = 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Circulation_History (Id VARCHAR); CREATE TABLE Employees (Id VARCHAR)
### question:List all employees in the circulation history of the document with id 1. List the employee's name. | SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id WHERE Circulation_History.document_id = 1 |
List the employees who have not showed up in any circulation history of documents. List the employee's name. | CREATE TABLE Circulation_History (employee_name VARCHAR); CREATE TABLE Employees (employee_name VARCHAR) | SELECT employee_name FROM Employees EXCEPT SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Circulation_History (employee_name VARCHAR); CREATE TABLE Employees (employee_name VARCHAR)
### question:List the employees who have not showed up in any circulation history of documents. List the employee's name. | SELECT employee_name FROM Employees EXCEPT SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id |
Which employee has showed up in most circulation history documents. List the employee's name and the number of drafts and copies. | CREATE TABLE Circulation_History (Id VARCHAR); CREATE TABLE Employees (Id VARCHAR) | SELECT Employees.employee_name, COUNT(*) FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id GROUP BY Circulation_History.document_id, Circulation_History.draft_number, Circulation_History.copy_number ORDER BY COUNT(*) DESC LIMIT 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Circulation_History (Id VARCHAR); CREATE TABLE Employees (Id VARCHAR)
### question:Which employee has showed up in most circulation history documents. List the employee's name and the number of drafts and copies. | SELECT Employees.employee_name, COUNT(*) FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id GROUP BY Circulation_History.document_id, Circulation_History.draft_number, Circulation_History.copy_number ORDER BY COUNT(*) DESC LIMIT 1 |
For each document, list the number of employees who have showed up in the circulation history of that document. List the document ids and number of employees. | CREATE TABLE Circulation_History (document_id VARCHAR, employee_id VARCHAR) | SELECT document_id, COUNT(DISTINCT employee_id) FROM Circulation_History GROUP BY document_id | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Circulation_History (document_id VARCHAR, employee_id VARCHAR)
### question:For each document, list the number of employees who have showed up in the circulation history of that document. List the document ids and number of employees. | SELECT document_id, COUNT(DISTINCT employee_id) FROM Circulation_History GROUP BY document_id |
List all department names ordered by their starting date. | CREATE TABLE department (dname VARCHAR, mgr_start_date VARCHAR) | SELECT dname FROM department ORDER BY mgr_start_date | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE department (dname VARCHAR, mgr_start_date VARCHAR)
### question:List all department names ordered by their starting date. | SELECT dname FROM department ORDER BY mgr_start_date |
find all dependent names who have a spouse relation with some employee. | CREATE TABLE dependent (Dependent_name VARCHAR, relationship VARCHAR) | SELECT Dependent_name FROM dependent WHERE relationship = 'Spouse' | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE dependent (Dependent_name VARCHAR, relationship VARCHAR)
### question:find all dependent names who have a spouse relation with some employee. | SELECT Dependent_name FROM dependent WHERE relationship = 'Spouse' |
how many female dependents are there? | CREATE TABLE dependent (sex VARCHAR) | SELECT COUNT(*) FROM dependent WHERE sex = 'F' | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE dependent (sex VARCHAR)
### question:how many female dependents are there? | SELECT COUNT(*) FROM dependent WHERE sex = 'F' |
Find the names of departments that are located in Houston. | CREATE TABLE dept_locations (dnumber VARCHAR, dlocation VARCHAR); CREATE TABLE department (dname VARCHAR, dnumber VARCHAR) | SELECT t1.dname FROM department AS t1 JOIN dept_locations AS t2 ON t1.dnumber = t2.dnumber WHERE t2.dlocation = 'Houston' | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE dept_locations (dnumber VARCHAR, dlocation VARCHAR); CREATE TABLE department (dname VARCHAR, dnumber VARCHAR)
### question:Find the names of departments that are located in Houston. | SELECT t1.dname FROM department AS t1 JOIN dept_locations AS t2 ON t1.dnumber = t2.dnumber WHERE t2.dlocation = 'Houston' |
Return the first names and last names of employees who earn more than 30000 in salary. | CREATE TABLE employee (fname VARCHAR, lname VARCHAR, salary INTEGER) | SELECT fname, lname FROM employee WHERE salary > 30000 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE employee (fname VARCHAR, lname VARCHAR, salary INTEGER)
### question:Return the first names and last names of employees who earn more than 30000 in salary. | SELECT fname, lname FROM employee WHERE salary > 30000 |
Find the number of employees of each gender whose salary is lower than 50000. | CREATE TABLE employee (sex VARCHAR, salary INTEGER) | SELECT COUNT(*), sex FROM employee WHERE salary < 50000 GROUP BY sex | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE employee (sex VARCHAR, salary INTEGER)
### question:Find the number of employees of each gender whose salary is lower than 50000. | SELECT COUNT(*), sex FROM employee WHERE salary < 50000 GROUP BY sex |
list the first and last names, and the addresses of all employees in the ascending order of their birth date. | CREATE TABLE employee (fname VARCHAR, lname VARCHAR, address VARCHAR, Bdate VARCHAR) | SELECT fname, lname, address FROM employee ORDER BY Bdate | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE employee (fname VARCHAR, lname VARCHAR, address VARCHAR, Bdate VARCHAR)
### question:list the first and last names, and the addresses of all employees in the ascending order of their birth date. | SELECT fname, lname, address FROM employee ORDER BY Bdate |
what are the event details of the services that have the type code 'Marriage'? | CREATE TABLE EVENTS (event_details VARCHAR, Service_ID VARCHAR); CREATE TABLE Services (Service_ID VARCHAR, Service_Type_Code VARCHAR) | SELECT T1.event_details FROM EVENTS AS T1 JOIN Services AS T2 ON T1.Service_ID = T2.Service_ID WHERE T2.Service_Type_Code = 'Marriage' | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE EVENTS (event_details VARCHAR, Service_ID VARCHAR); CREATE TABLE Services (Service_ID VARCHAR, Service_Type_Code VARCHAR)
### question:what are the event details of the services that have the type code 'Marriage'? | SELECT T1.event_details FROM EVENTS AS T1 JOIN Services AS T2 ON T1.Service_ID = T2.Service_ID WHERE T2.Service_Type_Code = 'Marriage' |
What are the ids and details of events that have more than one participants? | CREATE TABLE EVENTS (event_id VARCHAR, event_details VARCHAR, Event_ID VARCHAR); CREATE TABLE Participants_in_Events (Event_ID VARCHAR) | SELECT T1.event_id, T1.event_details FROM EVENTS AS T1 JOIN Participants_in_Events AS T2 ON T1.Event_ID = T2.Event_ID GROUP BY T1.Event_ID HAVING COUNT(*) > 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE EVENTS (event_id VARCHAR, event_details VARCHAR, Event_ID VARCHAR); CREATE TABLE Participants_in_Events (Event_ID VARCHAR)
### question:What are the ids and details of events that have more than one participants? | SELECT T1.event_id, T1.event_details FROM EVENTS AS T1 JOIN Participants_in_Events AS T2 ON T1.Event_ID = T2.Event_ID GROUP BY T1.Event_ID HAVING COUNT(*) > 1 |
How many events have each participants attended? List the participant id, type and the number. | CREATE TABLE Participants (Participant_ID VARCHAR, Participant_Type_Code VARCHAR); CREATE TABLE Participants_in_Events (Participant_ID VARCHAR) | SELECT T1.Participant_ID, T1.Participant_Type_Code, COUNT(*) FROM Participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID GROUP BY T1.Participant_ID | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Participants (Participant_ID VARCHAR, Participant_Type_Code VARCHAR); CREATE TABLE Participants_in_Events (Participant_ID VARCHAR)
### question:How many events have each participants attended? List the participant id, type and the number. | SELECT T1.Participant_ID, T1.Participant_Type_Code, COUNT(*) FROM Participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID GROUP BY T1.Participant_ID |
What are all the the participant ids, type code and details? | CREATE TABLE Participants (Participant_ID VARCHAR, Participant_Type_Code VARCHAR, Participant_Details VARCHAR) | SELECT Participant_ID, Participant_Type_Code, Participant_Details FROM Participants | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Participants (Participant_ID VARCHAR, Participant_Type_Code VARCHAR, Participant_Details VARCHAR)
### question:What are all the the participant ids, type code and details? | SELECT Participant_ID, Participant_Type_Code, Participant_Details FROM Participants |
How many participants belong to the type 'Organizer'? | CREATE TABLE participants (participant_type_code VARCHAR) | SELECT COUNT(*) FROM participants WHERE participant_type_code = 'Organizer' | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE participants (participant_type_code VARCHAR)
### question:How many participants belong to the type 'Organizer'? | SELECT COUNT(*) FROM participants WHERE participant_type_code = 'Organizer' |
List the type of the services in alphabetical order. | CREATE TABLE services (service_type_code VARCHAR) | SELECT service_type_code FROM services ORDER BY service_type_code | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE services (service_type_code VARCHAR)
### question:List the type of the services in alphabetical order. | SELECT service_type_code FROM services ORDER BY service_type_code |
List the service id and details for the events. | CREATE TABLE EVENTS (service_id VARCHAR, event_details VARCHAR) | SELECT service_id, event_details FROM EVENTS | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE EVENTS (service_id VARCHAR, event_details VARCHAR)
### question:List the service id and details for the events. | SELECT service_id, event_details FROM EVENTS |
How many events had participants whose details had the substring 'Dr.' | CREATE TABLE participants (Participant_ID VARCHAR, participant_details VARCHAR); CREATE TABLE Participants_in_Events (Participant_ID VARCHAR) | SELECT COUNT(*) FROM participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID WHERE T1.participant_details LIKE '%Dr.%' | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE participants (Participant_ID VARCHAR, participant_details VARCHAR); CREATE TABLE Participants_in_Events (Participant_ID VARCHAR)
### question:How many events had participants whose details had the substring 'Dr.' | SELECT COUNT(*) FROM participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID WHERE T1.participant_details LIKE '%Dr.%' |
What is the most common participant type? | CREATE TABLE participants (participant_type_code VARCHAR) | SELECT participant_type_code FROM participants GROUP BY participant_type_code ORDER BY COUNT(*) DESC LIMIT 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE participants (participant_type_code VARCHAR)
### question:What is the most common participant type? | SELECT participant_type_code FROM participants GROUP BY participant_type_code ORDER BY COUNT(*) DESC LIMIT 1 |
Which service id and type has the least number of participants? | CREATE TABLE Participants_in_Events (Participant_ID VARCHAR, Event_ID VARCHAR); CREATE TABLE services (Service_Type_Code VARCHAR, service_id VARCHAR); CREATE TABLE EVENTS (service_id VARCHAR, Event_ID VARCHAR); CREATE TABLE participants (Participant_ID VARCHAR) | SELECT T3.service_id, T4.Service_Type_Code FROM participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID JOIN EVENTS AS T3 ON T2.Event_ID = T3.Event_ID JOIN services AS T4 ON T3.service_id = T4.service_id GROUP BY T3.service_id ORDER BY COUNT(*) LIMIT 1 | Translate the question into SQL query by using the schema.
### schema:CREATE TABLE Participants_in_Events (Participant_ID VARCHAR, Event_ID VARCHAR); CREATE TABLE services (Service_Type_Code VARCHAR, service_id VARCHAR); CREATE TABLE EVENTS (service_id VARCHAR, Event_ID VARCHAR); CREATE TABLE participants (Participant_ID VARCHAR)
### question:Which service id and type has the least number of participants? | SELECT T3.service_id, T4.Service_Type_Code FROM participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID = T2.Participant_ID JOIN EVENTS AS T3 ON T2.Event_ID = T3.Event_ID JOIN services AS T4 ON T3.service_id = T4.service_id GROUP BY T3.service_id ORDER BY COUNT(*) LIMIT 1 |