db_name
stringclasses
146 values
prompt
stringlengths
310
4.81k
city_record
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # city ( City_ID, City, Hanzi, Hanyu_Pinyin, Regional_Population, GDP ) # match ( Match_ID, Date, Venue, Score, Result, Competition ) # temperature ( City_ID, Jan, Feb, Mar, Apr, Jun, Jul, Aug, Sep, Oct, Nov, Dec ) # hosting_city ( Year, Match_ID, Host_City ) # # temperature.City_ID can be joined with city.City_ID # hosting_city.Match_ID can be joined with match.Match_ID # hosting_city.Host_City can be joined with city.City_ID # ### Question: # # Find the number of matches in different competitions. # ### SQL: # # SELECT count(*) , Competition FROM MATCH GROUP BY Competition # ### End.
city_record
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # city ( City_ID, City, Hanzi, Hanyu_Pinyin, Regional_Population, GDP ) # match ( Match_ID, Date, Venue, Score, Result, Competition ) # temperature ( City_ID, Jan, Feb, Mar, Apr, Jun, Jul, Aug, Sep, Oct, Nov, Dec ) # hosting_city ( Year, Match_ID, Host_City ) # # temperature.City_ID can be joined with city.City_ID # hosting_city.Match_ID can be joined with match.Match_ID # hosting_city.Host_City can be joined with city.City_ID # ### Question: # # For each competition, count the number of matches. # ### SQL: # # SELECT count(*) , Competition FROM MATCH GROUP BY Competition # ### End.
city_record
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # city ( City_ID, City, Hanzi, Hanyu_Pinyin, Regional_Population, GDP ) # match ( Match_ID, Date, Venue, Score, Result, Competition ) # temperature ( City_ID, Jan, Feb, Mar, Apr, Jun, Jul, Aug, Sep, Oct, Nov, Dec ) # hosting_city ( Year, Match_ID, Host_City ) # # temperature.City_ID can be joined with city.City_ID # hosting_city.Match_ID can be joined with match.Match_ID # hosting_city.Host_City can be joined with city.City_ID # ### Question: # # List venues of all matches in the order of their dates starting from the most recent one. # ### SQL: # # SELECT venue FROM MATCH ORDER BY date DESC # ### End.
city_record
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # city ( City_ID, City, Hanzi, Hanyu_Pinyin, Regional_Population, GDP ) # match ( Match_ID, Date, Venue, Score, Result, Competition ) # temperature ( City_ID, Jan, Feb, Mar, Apr, Jun, Jul, Aug, Sep, Oct, Nov, Dec ) # hosting_city ( Year, Match_ID, Host_City ) # # temperature.City_ID can be joined with city.City_ID # hosting_city.Match_ID can be joined with match.Match_ID # hosting_city.Host_City can be joined with city.City_ID # ### Question: # # What are the venues of all the matches? Sort them in the descending order of match date. # ### SQL: # # SELECT venue FROM MATCH ORDER BY date DESC # ### End.
city_record
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # city ( City_ID, City, Hanzi, Hanyu_Pinyin, Regional_Population, GDP ) # match ( Match_ID, Date, Venue, Score, Result, Competition ) # temperature ( City_ID, Jan, Feb, Mar, Apr, Jun, Jul, Aug, Sep, Oct, Nov, Dec ) # hosting_city ( Year, Match_ID, Host_City ) # # temperature.City_ID can be joined with city.City_ID # hosting_city.Match_ID can be joined with match.Match_ID # hosting_city.Host_City can be joined with city.City_ID # ### Question: # # what is the GDP of the city with the largest population. # ### SQL: # # SELECT gdp FROM city ORDER BY Regional_Population DESC LIMIT 1 # ### End.
city_record
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # city ( City_ID, City, Hanzi, Hanyu_Pinyin, Regional_Population, GDP ) # match ( Match_ID, Date, Venue, Score, Result, Competition ) # temperature ( City_ID, Jan, Feb, Mar, Apr, Jun, Jul, Aug, Sep, Oct, Nov, Dec ) # hosting_city ( Year, Match_ID, Host_City ) # # temperature.City_ID can be joined with city.City_ID # hosting_city.Match_ID can be joined with match.Match_ID # hosting_city.Host_City can be joined with city.City_ID # ### Question: # # Find the GDP of the city with the largest regional population. # ### SQL: # # SELECT gdp FROM city ORDER BY Regional_Population DESC LIMIT 1 # ### End.
city_record
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # city ( City_ID, City, Hanzi, Hanyu_Pinyin, Regional_Population, GDP ) # match ( Match_ID, Date, Venue, Score, Result, Competition ) # temperature ( City_ID, Jan, Feb, Mar, Apr, Jun, Jul, Aug, Sep, Oct, Nov, Dec ) # hosting_city ( Year, Match_ID, Host_City ) # # temperature.City_ID can be joined with city.City_ID # hosting_city.Match_ID can be joined with match.Match_ID # hosting_city.Host_City can be joined with city.City_ID # ### Question: # # What are the GDP and population of the city that already served as a host more than once? # ### SQL: # # 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 # ### End.
city_record
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # city ( City_ID, City, Hanzi, Hanyu_Pinyin, Regional_Population, GDP ) # match ( Match_ID, Date, Venue, Score, Result, Competition ) # temperature ( City_ID, Jan, Feb, Mar, Apr, Jun, Jul, Aug, Sep, Oct, Nov, Dec ) # hosting_city ( Year, Match_ID, Host_City ) # # temperature.City_ID can be joined with city.City_ID # hosting_city.Match_ID can be joined with match.Match_ID # hosting_city.Host_City can be joined with city.City_ID # ### Question: # # Which cities have served as host cities more than once? Return me their GDP and population. # ### SQL: # # 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 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # List every individual's first name, middle name and last name in alphabetical order by last name. # ### SQL: # # SELECT individual_first_name , individual_middle_name , individual_last_name FROM individuals ORDER BY individual_last_name # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # What are the first, middle, and last names of all individuals, ordered by last name? # ### SQL: # # SELECT individual_first_name , individual_middle_name , individual_last_name FROM individuals ORDER BY individual_last_name # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # List all the types of forms. # ### SQL: # # SELECT DISTINCT form_type_code FROM forms # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # What are the different types of forms? # ### SQL: # # SELECT DISTINCT form_type_code FROM forms # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Find the name of the most popular party form. # ### SQL: # # 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 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # What is the name of the party form that is most common? # ### SQL: # # 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 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Find the payment method and phone of the party with email "enrico09@example.com". # ### SQL: # # SELECT payment_method_code , party_phone FROM parties WHERE party_email = "enrico09@example.com" # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # What is the payment method code and party phone of the party with the email 'enrico09@example.com'? # ### SQL: # # SELECT payment_method_code , party_phone FROM parties WHERE party_email = "enrico09@example.com" # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Find the emails of parties with the most popular party form. # ### SQL: # # 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) # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # What are the party emails associated with parties that used the party form that is the most common? # ### SQL: # # 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) # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # List all the name of organizations in order of the date formed. # ### SQL: # # SELECT organization_name FROM organizations ORDER BY date_formed ASC # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # What are the names of organizations, ordered by the date they were formed, ascending? # ### SQL: # # SELECT organization_name FROM organizations ORDER BY date_formed ASC # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Find the name of the youngest organization. # ### SQL: # # SELECT organization_name FROM organizations ORDER BY date_formed DESC LIMIT 1 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # What is the name of the organization that was formed most recently? # ### SQL: # # SELECT organization_name FROM organizations ORDER BY date_formed DESC LIMIT 1 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Find the last name of the latest contact individual of the organization "Labour Party". # ### SQL: # # 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 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # What is the last name of the contact individual from the Labour party organization who was contacted most recently? # ### SQL: # # 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 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Find the last name of the first ever contact person of the organization with the highest UK Vat number. # ### SQL: # # 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 ASC LIMIT 1 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # What is the last name of the first individual contacted from the organization with the maximum UK Vat number across all organizations? # ### SQL: # # 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 ASC LIMIT 1 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # How many services are there? # ### SQL: # # SELECT count(*) FROM services # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Count the number of services. # ### SQL: # # SELECT count(*) FROM services # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Find name of the services that has never been used. # ### SQL: # # 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 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # What are the names of the services that have never been used? # ### SQL: # # 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 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Find the name of all the cities and states. # ### SQL: # # SELECT town_city FROM addresses UNION SELECT state_province_county FROM addresses # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # What are the names of all cities and states? # ### SQL: # # SELECT town_city FROM addresses UNION SELECT state_province_county FROM addresses # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # How many cities are there in state "Colorado"? # ### SQL: # # SELECT count(*) FROM addresses WHERE state_province_county = "Colorado" # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Count the number of cities in the state of Colorado. # ### SQL: # # SELECT count(*) FROM addresses WHERE state_province_county = "Colorado" # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Find the payment method code used by more than 3 parties. # ### SQL: # # SELECT payment_method_code FROM parties GROUP BY payment_method_code HAVING count(*) > 3 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # What are the payment method codes that have been used by more than 3 parties? # ### SQL: # # SELECT payment_method_code FROM parties GROUP BY payment_method_code HAVING count(*) > 3 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Find the name of organizations whose names contain "Party". # ### SQL: # # SELECT organization_name FROM organizations WHERE organization_name LIKE "%Party%" # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # What are the names of organizations that contain the word "Party"? # ### SQL: # # SELECT organization_name FROM organizations WHERE organization_name LIKE "%Party%" # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # How many distinct payment methods are used by parties? # ### SQL: # # SELECT count(DISTINCT payment_method_code) FROM parties # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Count the number of different payment method codes used by parties. # ### SQL: # # SELECT count(DISTINCT payment_method_code) FROM parties # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Which is the email of the party that has used the services the most number of times? # ### SQL: # # 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 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Return the party email that has used party services the greatest number of times. # ### SQL: # # 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 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Which state can address "6862 Kaitlyn Knolls" possibly be in? # ### SQL: # # SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE "%6862 Kaitlyn Knolls%" # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Give the state corresponding to the line number building "6862 Kaitlyn Knolls". # ### SQL: # # SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE "%6862 Kaitlyn Knolls%" # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # What is the name of organization that has the greatest number of contact individuals? # ### SQL: # # 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 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Return the name of the organization which has the most contact individuals. # ### SQL: # # 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 # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # Find the last name of the individuals that have been contact individuals of an organization. # ### SQL: # # SELECT DISTINCT t1.individual_last_name FROM individuals AS t1 JOIN organization_contact_individuals AS t2 ON t1.individual_id = t2.individual_id # ### End.
e_government
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Addresses ( address_id, line_1_number_building, town_city, zip_postcode, state_province_county, country ) # Services ( service_id, service_type_code, service_name, service_descriptio ) # Forms ( form_id, form_type_code, service_id, form_number, form_name, form_description ) # Individuals ( individual_id, individual_first_name, individual_middle_name, inidividual_phone, individual_email, individual_address, individual_last_name ) # Organizations ( organization_id, date_formed, organization_name, uk_vat_number ) # Parties ( party_id, payment_method_code, party_phone, party_email ) # Organization_Contact_Individuals ( individual_id, organization_id, date_contact_from, date_contact_to ) # Party_Addresses ( party_id, address_id, date_address_from, address_type_code, date_address_to ) # Party_Forms ( party_id, form_id, date_completion_started, form_status_code, date_fully_completed ) # Party_Services ( booking_id, customer_id, service_id, service_datetime, booking_made_date ) # # Forms.service_id can be joined with Services.service_id # Organization_Contact_Individuals.individual_id can be joined with Individuals.individual_id # Organization_Contact_Individuals.organization_id can be joined with Organizations.organization_id # Party_Addresses.party_id can be joined with Parties.party_id # Party_Addresses.address_id can be joined with Addresses.address_id # Party_Forms.form_id can be joined with Forms.form_id # Party_Forms.party_id can be joined with Parties.party_id # Party_Services.customer_id can be joined with Parties.party_id # Party_Services.service_id can be joined with Services.service_id # ### Question: # # What are the last names of individuals who have been contact individuals for an organization? # ### SQL: # # SELECT DISTINCT t1.individual_last_name FROM individuals AS t1 JOIN organization_contact_individuals AS t2 ON t1.individual_id = t2.individual_id # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # How many drivers are there? # ### SQL: # # SELECT count(*) FROM driver # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # Show the name, home city, and age for all drivers. # ### SQL: # # SELECT name , home_city , age FROM driver # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # Show the party and the number of drivers in each party. # ### SQL: # # SELECT party , count(*) FROM driver GROUP BY party # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # Show the name of drivers in descending order of age. # ### SQL: # # SELECT name FROM driver ORDER BY age DESC # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # Show all different home cities. # ### SQL: # # SELECT DISTINCT home_city FROM driver # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # Show the home city with the most number of drivers. # ### SQL: # # SELECT home_city FROM driver GROUP BY home_city ORDER BY count(*) DESC LIMIT 1 # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # Show the party with drivers from Hartford and drivers older than 40. # ### SQL: # # SELECT party FROM driver WHERE home_city = 'Hartford' AND age > 40 # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # Show home city where at least two drivers older than 40 are from. # ### SQL: # # SELECT home_city FROM driver WHERE age > 40 GROUP BY home_city HAVING count(*) >= 2 # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # Show all home cities except for those having a driver older than 40. # ### SQL: # # SELECT home_city FROM driver EXCEPT SELECT home_city FROM driver WHERE age > 40 # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # Show the names of the drivers without a school bus. # ### SQL: # # SELECT name FROM driver WHERE driver_id NOT IN (SELECT driver_id FROM school_bus) # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # Show the types of schools that have two schools. # ### SQL: # # SELECT TYPE FROM school GROUP BY TYPE HAVING count(*) = 2 # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # Show the school name and driver name for all school buses. # ### SQL: # # SELECT T2.school , T3.name FROM school_bus AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id JOIN driver AS T3 ON T1.driver_id = T3.driver_id # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # What is the maximum, minimum and average years spent working on a school bus? # ### SQL: # # SELECT max(years_working) , min(years_working) , avg(years_working) FROM school_bus # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # Show the school name and type for schools without a school bus. # ### SQL: # # SELECT school , TYPE FROM school WHERE school_id NOT IN (SELECT school_id FROM school_bus) # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # Show the type of school and the number of buses for each type. # ### SQL: # # SELECT T2.type , count(*) FROM school_bus AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id GROUP BY T2.type # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # How many drivers are from Hartford city or younger than 40? # ### SQL: # # SELECT count(*) FROM driver WHERE home_city = 'Hartford' OR age < 40 # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # List names for drivers from Hartford city and younger than 40. # ### SQL: # # SELECT name FROM driver WHERE home_city = 'Hartford' AND age < 40 # ### End.
school_bus
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # driver ( Driver_ID, Name, Party, Home_city, Age ) # school ( School_ID, Grade, School, Location, Type ) # school_bus ( School_ID, Driver_ID, Years_Working, If_full_time ) # # school_bus.Driver_ID can be joined with driver.Driver_ID # school_bus.School_ID can be joined with school.School_ID # ### Question: # # find the name of driver who is driving the school bus with the longest working history. # ### SQL: # # SELECT t1.name FROM driver AS t1 JOIN school_bus AS t2 ON t1.driver_id = t2.driver_id ORDER BY years_working DESC LIMIT 1 # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # How many flights have a velocity larger than 200? # ### SQL: # # SELECT count(*) FROM flight WHERE velocity > 200 # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # List the vehicle flight number, date and pilot of all the flights, ordered by altitude. # ### SQL: # # SELECT vehicle_flight_number , date , pilot FROM flight ORDER BY altitude ASC # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # List the id, country, city and name of the airports ordered alphabetically by the name. # ### SQL: # # SELECT id , country , city , name FROM airport ORDER BY name # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # What is maximum group equity shareholding of the companies? # ### SQL: # # SELECT max(group_equity_shareholding) FROM operate_company # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # What is the velocity of the pilot named 'Thompson'? # ### SQL: # # SELECT avg(velocity) FROM flight WHERE pilot = 'Thompson' # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # What are the names and types of the companies that have ever operated a flight? # ### SQL: # # SELECT T1.name , T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # What are the names of the airports which are not in the country 'Iceland'? # ### SQL: # # SELECT name FROM airport WHERE country != 'Iceland' # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # What are the distinct types of the companies that have operated any flights with velocity less than 200? # ### SQL: # # SELECT DISTINCT T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T2.velocity < 200 # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # What are the ids and names of the companies that operated more than one flight? # ### SQL: # # SELECT T1.id , T1.name FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id GROUP BY T1.id HAVING count(*) > 1 # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # What is the id, name and IATA code of the airport that had most number of flights? # ### SQL: # # SELECT T1.id , T1.name , T1.IATA FROM airport AS T1 JOIN flight AS T2 ON T1.id = T2.airport_id GROUP BY T2.id ORDER BY count(*) DESC LIMIT 1 # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # What are the different pilot names who had piloted a flight in the country 'United States' or in the airport named 'Billund Airport'? # ### SQL: # # SELECT DISTINCT T2.pilot FROM airport AS T1 JOIN flight AS T2 ON T1.id = T2.airport_id WHERE T1.country = 'United States' OR T1.name = 'Billund Airport' # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # What is the most common company type, and how many are there? # ### SQL: # # SELECT TYPE , count(*) FROM operate_company GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1 # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # How many airports haven't the pilot 'Thompson' driven an aircraft? # ### SQL: # # SELECT count(*) FROM airport WHERE id NOT IN ( SELECT airport_id FROM flight WHERE pilot = 'Thompson' ); # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # List the name of the pilots who have flied for both a company that mainly provide 'Cargo' services and a company that runs 'Catering services' activities. # ### SQL: # # SELECT T2.pilot FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T1.principal_activities = 'Cargo' INTERSECT SELECT T2.pilot FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T1.principal_activities = 'Catering services' # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # Which of the airport names contains the word 'international'? # ### SQL: # # SELECT name FROM airport WHERE name LIKE '%international%' # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # How many companies operates airlines in each airport? # ### SQL: # # SELECT T3.id , count(*) FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id JOIN airport AS T3 ON T2.airport_id = T3.id GROUP BY T3.id # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # how many airports are there in each country? # ### SQL: # # SELECT count(*) , country FROM airport GROUP BY country # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # which countries have more than 2 airports? # ### SQL: # # SELECT country FROM airport GROUP BY country HAVING count(*) > 2 # ### End.
flight_company
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # airport ( id, City, Country, IATA, ICAO, name ) # operate_company ( id, name, Type, Principal_activities, Incorporated_in, Group_Equity_Shareholding ) # flight ( id, Vehicle_Flight_number, Date, Pilot, Velocity, Altitude, airport_id, company_id ) # # flight.company_id can be joined with operate_company.id # flight.airport_id can be joined with airport.id # ### Question: # # which pilot is in charge of the most number of flights? # ### SQL: # # SELECT pilot FROM flight GROUP BY pilot ORDER BY count(*) DESC LIMIT 1 # ### End.
cre_Docs_and_Epenses
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Ref_Document_Types ( Document_Type_Code, Document_Type_Name, Document_Type_Description ) # Ref_Budget_Codes ( Budget_Type_Code, Budget_Type_Description ) # Projects ( Project_ID, Project_Details ) # Documents ( Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details ) # Statements ( Statement_ID, Statement_Details ) # Documents_with_Expenses ( Document_ID, Budget_Type_Code, Document_Details ) # Accounts ( Account_ID, Statement_ID, Account_Details ) # # Documents.Project_ID can be joined with Projects.Project_ID # Documents.Document_Type_Code can be joined with Ref_Document_Types.Document_Type_Code # Statements.Statement_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Document_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Budget_Type_Code can be joined with Ref_Budget_Codes.Budget_Type_Code # Accounts.Statement_ID can be joined with Statements.Statement_ID # ### Question: # # How many accounts do we have? # ### SQL: # # SELECT count(*) FROM Accounts # ### End.
cre_Docs_and_Epenses
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Ref_Document_Types ( Document_Type_Code, Document_Type_Name, Document_Type_Description ) # Ref_Budget_Codes ( Budget_Type_Code, Budget_Type_Description ) # Projects ( Project_ID, Project_Details ) # Documents ( Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details ) # Statements ( Statement_ID, Statement_Details ) # Documents_with_Expenses ( Document_ID, Budget_Type_Code, Document_Details ) # Accounts ( Account_ID, Statement_ID, Account_Details ) # # Documents.Project_ID can be joined with Projects.Project_ID # Documents.Document_Type_Code can be joined with Ref_Document_Types.Document_Type_Code # Statements.Statement_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Document_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Budget_Type_Code can be joined with Ref_Budget_Codes.Budget_Type_Code # Accounts.Statement_ID can be joined with Statements.Statement_ID # ### Question: # # Count the number of accounts. # ### SQL: # # SELECT count(*) FROM Accounts # ### End.
cre_Docs_and_Epenses
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Ref_Document_Types ( Document_Type_Code, Document_Type_Name, Document_Type_Description ) # Ref_Budget_Codes ( Budget_Type_Code, Budget_Type_Description ) # Projects ( Project_ID, Project_Details ) # Documents ( Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details ) # Statements ( Statement_ID, Statement_Details ) # Documents_with_Expenses ( Document_ID, Budget_Type_Code, Document_Details ) # Accounts ( Account_ID, Statement_ID, Account_Details ) # # Documents.Project_ID can be joined with Projects.Project_ID # Documents.Document_Type_Code can be joined with Ref_Document_Types.Document_Type_Code # Statements.Statement_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Document_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Budget_Type_Code can be joined with Ref_Budget_Codes.Budget_Type_Code # Accounts.Statement_ID can be joined with Statements.Statement_ID # ### Question: # # Show all account ids and account details. # ### SQL: # # SELECT account_id , account_details FROM Accounts # ### End.
cre_Docs_and_Epenses
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Ref_Document_Types ( Document_Type_Code, Document_Type_Name, Document_Type_Description ) # Ref_Budget_Codes ( Budget_Type_Code, Budget_Type_Description ) # Projects ( Project_ID, Project_Details ) # Documents ( Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details ) # Statements ( Statement_ID, Statement_Details ) # Documents_with_Expenses ( Document_ID, Budget_Type_Code, Document_Details ) # Accounts ( Account_ID, Statement_ID, Account_Details ) # # Documents.Project_ID can be joined with Projects.Project_ID # Documents.Document_Type_Code can be joined with Ref_Document_Types.Document_Type_Code # Statements.Statement_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Document_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Budget_Type_Code can be joined with Ref_Budget_Codes.Budget_Type_Code # Accounts.Statement_ID can be joined with Statements.Statement_ID # ### Question: # # What are the ids and details of all accounts? # ### SQL: # # SELECT account_id , account_details FROM Accounts # ### End.
cre_Docs_and_Epenses
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Ref_Document_Types ( Document_Type_Code, Document_Type_Name, Document_Type_Description ) # Ref_Budget_Codes ( Budget_Type_Code, Budget_Type_Description ) # Projects ( Project_ID, Project_Details ) # Documents ( Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details ) # Statements ( Statement_ID, Statement_Details ) # Documents_with_Expenses ( Document_ID, Budget_Type_Code, Document_Details ) # Accounts ( Account_ID, Statement_ID, Account_Details ) # # Documents.Project_ID can be joined with Projects.Project_ID # Documents.Document_Type_Code can be joined with Ref_Document_Types.Document_Type_Code # Statements.Statement_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Document_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Budget_Type_Code can be joined with Ref_Budget_Codes.Budget_Type_Code # Accounts.Statement_ID can be joined with Statements.Statement_ID # ### Question: # # How many statements do we have? # ### SQL: # # SELECT count(*) FROM Statements # ### End.
cre_Docs_and_Epenses
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Ref_Document_Types ( Document_Type_Code, Document_Type_Name, Document_Type_Description ) # Ref_Budget_Codes ( Budget_Type_Code, Budget_Type_Description ) # Projects ( Project_ID, Project_Details ) # Documents ( Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details ) # Statements ( Statement_ID, Statement_Details ) # Documents_with_Expenses ( Document_ID, Budget_Type_Code, Document_Details ) # Accounts ( Account_ID, Statement_ID, Account_Details ) # # Documents.Project_ID can be joined with Projects.Project_ID # Documents.Document_Type_Code can be joined with Ref_Document_Types.Document_Type_Code # Statements.Statement_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Document_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Budget_Type_Code can be joined with Ref_Budget_Codes.Budget_Type_Code # Accounts.Statement_ID can be joined with Statements.Statement_ID # ### Question: # # Count the number of statements. # ### SQL: # # SELECT count(*) FROM Statements # ### End.
cre_Docs_and_Epenses
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Ref_Document_Types ( Document_Type_Code, Document_Type_Name, Document_Type_Description ) # Ref_Budget_Codes ( Budget_Type_Code, Budget_Type_Description ) # Projects ( Project_ID, Project_Details ) # Documents ( Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details ) # Statements ( Statement_ID, Statement_Details ) # Documents_with_Expenses ( Document_ID, Budget_Type_Code, Document_Details ) # Accounts ( Account_ID, Statement_ID, Account_Details ) # # Documents.Project_ID can be joined with Projects.Project_ID # Documents.Document_Type_Code can be joined with Ref_Document_Types.Document_Type_Code # Statements.Statement_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Document_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Budget_Type_Code can be joined with Ref_Budget_Codes.Budget_Type_Code # Accounts.Statement_ID can be joined with Statements.Statement_ID # ### Question: # # List all statement ids and statement details. # ### SQL: # # SELECT STATEMENT_ID , statement_details FROM Statements # ### End.
cre_Docs_and_Epenses
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Ref_Document_Types ( Document_Type_Code, Document_Type_Name, Document_Type_Description ) # Ref_Budget_Codes ( Budget_Type_Code, Budget_Type_Description ) # Projects ( Project_ID, Project_Details ) # Documents ( Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details ) # Statements ( Statement_ID, Statement_Details ) # Documents_with_Expenses ( Document_ID, Budget_Type_Code, Document_Details ) # Accounts ( Account_ID, Statement_ID, Account_Details ) # # Documents.Project_ID can be joined with Projects.Project_ID # Documents.Document_Type_Code can be joined with Ref_Document_Types.Document_Type_Code # Statements.Statement_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Document_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Budget_Type_Code can be joined with Ref_Budget_Codes.Budget_Type_Code # Accounts.Statement_ID can be joined with Statements.Statement_ID # ### Question: # # What are the ids and details of all statements? # ### SQL: # # SELECT STATEMENT_ID , statement_details FROM Statements # ### End.
cre_Docs_and_Epenses
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Ref_Document_Types ( Document_Type_Code, Document_Type_Name, Document_Type_Description ) # Ref_Budget_Codes ( Budget_Type_Code, Budget_Type_Description ) # Projects ( Project_ID, Project_Details ) # Documents ( Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details ) # Statements ( Statement_ID, Statement_Details ) # Documents_with_Expenses ( Document_ID, Budget_Type_Code, Document_Details ) # Accounts ( Account_ID, Statement_ID, Account_Details ) # # Documents.Project_ID can be joined with Projects.Project_ID # Documents.Document_Type_Code can be joined with Ref_Document_Types.Document_Type_Code # Statements.Statement_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Document_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Budget_Type_Code can be joined with Ref_Budget_Codes.Budget_Type_Code # Accounts.Statement_ID can be joined with Statements.Statement_ID # ### Question: # # Show statement id, statement detail, account detail for accounts. # ### SQL: # # SELECT T1.statement_id , T2.statement_details , T1.account_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id # ### End.
cre_Docs_and_Epenses
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Ref_Document_Types ( Document_Type_Code, Document_Type_Name, Document_Type_Description ) # Ref_Budget_Codes ( Budget_Type_Code, Budget_Type_Description ) # Projects ( Project_ID, Project_Details ) # Documents ( Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details ) # Statements ( Statement_ID, Statement_Details ) # Documents_with_Expenses ( Document_ID, Budget_Type_Code, Document_Details ) # Accounts ( Account_ID, Statement_ID, Account_Details ) # # Documents.Project_ID can be joined with Projects.Project_ID # Documents.Document_Type_Code can be joined with Ref_Document_Types.Document_Type_Code # Statements.Statement_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Document_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Budget_Type_Code can be joined with Ref_Budget_Codes.Budget_Type_Code # Accounts.Statement_ID can be joined with Statements.Statement_ID # ### Question: # # What are the statement ids, statement details, and account details, for all accounts? # ### SQL: # # SELECT T1.statement_id , T2.statement_details , T1.account_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id # ### End.
cre_Docs_and_Epenses
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Ref_Document_Types ( Document_Type_Code, Document_Type_Name, Document_Type_Description ) # Ref_Budget_Codes ( Budget_Type_Code, Budget_Type_Description ) # Projects ( Project_ID, Project_Details ) # Documents ( Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details ) # Statements ( Statement_ID, Statement_Details ) # Documents_with_Expenses ( Document_ID, Budget_Type_Code, Document_Details ) # Accounts ( Account_ID, Statement_ID, Account_Details ) # # Documents.Project_ID can be joined with Projects.Project_ID # Documents.Document_Type_Code can be joined with Ref_Document_Types.Document_Type_Code # Statements.Statement_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Document_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Budget_Type_Code can be joined with Ref_Budget_Codes.Budget_Type_Code # Accounts.Statement_ID can be joined with Statements.Statement_ID # ### Question: # # Show all statement id and the number of accounts for each statement. # ### SQL: # # SELECT STATEMENT_ID , count(*) FROM Accounts GROUP BY STATEMENT_ID # ### End.
cre_Docs_and_Epenses
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Ref_Document_Types ( Document_Type_Code, Document_Type_Name, Document_Type_Description ) # Ref_Budget_Codes ( Budget_Type_Code, Budget_Type_Description ) # Projects ( Project_ID, Project_Details ) # Documents ( Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details ) # Statements ( Statement_ID, Statement_Details ) # Documents_with_Expenses ( Document_ID, Budget_Type_Code, Document_Details ) # Accounts ( Account_ID, Statement_ID, Account_Details ) # # Documents.Project_ID can be joined with Projects.Project_ID # Documents.Document_Type_Code can be joined with Ref_Document_Types.Document_Type_Code # Statements.Statement_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Document_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Budget_Type_Code can be joined with Ref_Budget_Codes.Budget_Type_Code # Accounts.Statement_ID can be joined with Statements.Statement_ID # ### Question: # # What are the different statement ids on accounts, and the number of accounts for each? # ### SQL: # # SELECT STATEMENT_ID , count(*) FROM Accounts GROUP BY STATEMENT_ID # ### End.
cre_Docs_and_Epenses
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Ref_Document_Types ( Document_Type_Code, Document_Type_Name, Document_Type_Description ) # Ref_Budget_Codes ( Budget_Type_Code, Budget_Type_Description ) # Projects ( Project_ID, Project_Details ) # Documents ( Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details ) # Statements ( Statement_ID, Statement_Details ) # Documents_with_Expenses ( Document_ID, Budget_Type_Code, Document_Details ) # Accounts ( Account_ID, Statement_ID, Account_Details ) # # Documents.Project_ID can be joined with Projects.Project_ID # Documents.Document_Type_Code can be joined with Ref_Document_Types.Document_Type_Code # Statements.Statement_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Document_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Budget_Type_Code can be joined with Ref_Budget_Codes.Budget_Type_Code # Accounts.Statement_ID can be joined with Statements.Statement_ID # ### Question: # # Show the statement id and the statement detail for the statement with most number of accounts. # ### SQL: # # SELECT T1.statement_id , T2.statement_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id GROUP BY T1.statement_id ORDER BY count(*) DESC LIMIT 1 # ### End.
cre_Docs_and_Epenses
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Ref_Document_Types ( Document_Type_Code, Document_Type_Name, Document_Type_Description ) # Ref_Budget_Codes ( Budget_Type_Code, Budget_Type_Description ) # Projects ( Project_ID, Project_Details ) # Documents ( Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details ) # Statements ( Statement_ID, Statement_Details ) # Documents_with_Expenses ( Document_ID, Budget_Type_Code, Document_Details ) # Accounts ( Account_ID, Statement_ID, Account_Details ) # # Documents.Project_ID can be joined with Projects.Project_ID # Documents.Document_Type_Code can be joined with Ref_Document_Types.Document_Type_Code # Statements.Statement_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Document_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Budget_Type_Code can be joined with Ref_Budget_Codes.Budget_Type_Code # Accounts.Statement_ID can be joined with Statements.Statement_ID # ### Question: # # What are the statement id and statement detail for the statement that has the most corresponding accounts? # ### SQL: # # SELECT T1.statement_id , T2.statement_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id GROUP BY T1.statement_id ORDER BY count(*) DESC LIMIT 1 # ### End.
cre_Docs_and_Epenses
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Ref_Document_Types ( Document_Type_Code, Document_Type_Name, Document_Type_Description ) # Ref_Budget_Codes ( Budget_Type_Code, Budget_Type_Description ) # Projects ( Project_ID, Project_Details ) # Documents ( Document_ID, Document_Type_Code, Project_ID, Document_Date, Document_Name, Document_Description, Other_Details ) # Statements ( Statement_ID, Statement_Details ) # Documents_with_Expenses ( Document_ID, Budget_Type_Code, Document_Details ) # Accounts ( Account_ID, Statement_ID, Account_Details ) # # Documents.Project_ID can be joined with Projects.Project_ID # Documents.Document_Type_Code can be joined with Ref_Document_Types.Document_Type_Code # Statements.Statement_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Document_ID can be joined with Documents.Document_ID # Documents_with_Expenses.Budget_Type_Code can be joined with Ref_Budget_Codes.Budget_Type_Code # Accounts.Statement_ID can be joined with Statements.Statement_ID # ### Question: # # Show the number of documents. # ### SQL: # # SELECT count(*) FROM Documents # ### End.