richardr1126/spider-context-instruct huggingface dataset:
### Instruction:

Convert text to sql: Find the names of the swimmers who have both "win" and "loss" results in the record. | swimmer : id , name , nationality , meter_100 , meter_200 , meter_300 , meter_400 , meter_500 , meter_600 , meter_700 , time | stadium : id , name , capacity , city , country , opening_year | event : id , name , stadium_id , year | record : id , result , swimmer_id , event_id | event.stadium_id = stadium.id | record.swimmer_id = swimmer.id | record.event_id = event.id | 

### Response:

select swimmer.name from swimmer join record on swimmer.id = record.swimmer_id where result = 'Win' intersect select swimmer.name from swimmer join record on swimmer.id = record.swimmer_id where result = 'Loss'

### Instruction:

Convert text to sql: Find the names of stadiums that some Australian swimmers have been to. | swimmer : id , name , nationality , meter_100 , meter_200 , meter_300 , meter_400 , meter_500 , meter_600 , meter_700 , time | stadium : id , name , capacity , city , country , opening_year | event : id , name , stadium_id , year | record : id , result , swimmer_id , event_id | event.stadium_id = stadium.id | record.swimmer_id = swimmer.id | record.event_id = event.id | 

### Response:

select stadium.name from swimmer join record on swimmer.id = record.swimmer_id join event on record.event_id = event.id join stadium on stadium.id = event.stadium_id where swimmer.nationality = 'Australia'

### Instruction:

Convert text to sql: Find the names of stadiums that the most swimmers have been to. | swimmer : id , name , nationality , meter_100 , meter_200 , meter_300 , meter_400 , meter_500 , meter_600 , meter_700 , time | stadium : id , name , capacity , city , country , opening_year | event : id , name , stadium_id , year | record : id , result , swimmer_id , event_id | event.stadium_id = stadium.id | record.swimmer_id = swimmer.id | record.event_id = event.id | 

### Response:

select stadium.name from record join event on record.event_id = event.id join stadium on stadium.id = event.stadium_id group by event.stadium_id order by count ( * ) desc limit 1

### Instruction:

Convert text to sql: Find all details for each swimmer. | swimmer : id , name , nationality , meter_100 , meter_200 , meter_300 , meter_400 , meter_500 , meter_600 , meter_700 , time | stadium : id , name , capacity , city , country , opening_year | event : id , name , stadium_id , year | record : id , result , swimmer_id , event_id | event.stadium_id = stadium.id | record.swimmer_id = swimmer.id | record.event_id = event.id | 

### Response:

select * from swimmer

### Instruction:

Convert text to sql: What is the average capacity of the stadiums that were opened in year 2005? | swimmer : id , name , nationality , meter_100 , meter_200 , meter_300 , meter_400 , meter_500 , meter_600 , meter_700 , time | stadium : id , name , capacity , city , country , opening_year | event : id , name , stadium_id , year | record : id , result , swimmer_id , event_id | event.stadium_id = stadium.id | record.swimmer_id = swimmer.id | record.event_id = event.id | 

### Response:

select avg ( capacity ) from stadium where opening_year = 2005
### Instruction:

Convert text to sql: How many railways are there? | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select count ( * ) from railway

### Instruction:

Convert text to sql: List the builders of railways in ascending alphabetical order. | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select builder from railway order by builder asc

### Instruction:

Convert text to sql: List the wheels and locations of the railways. | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select wheels , location from railway

### Instruction:

Convert text to sql: What is the maximum level of managers in countries that are not "Australia"? | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select max ( level ) from manager where country != 'Australia	'

### Instruction:

Convert text to sql: What is the average age for all managers? | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select avg ( age ) from manager
### Instruction:

Convert text to sql: What are the names of managers in ascending order of level? | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select name from manager order by level asc

### Instruction:

Convert text to sql: What are the names and arrival times of trains? | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select name , arrival from train

### Instruction:

Convert text to sql: What is the name of the oldest manager? | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select name from manager order by age desc limit 1

### Instruction:

Convert text to sql: Show the names of trains and locations of railways they are in. | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select train.name , railway.location from railway join train on railway.railway_id = train.railway_id

### Instruction:

Convert text to sql: Show the builder of railways associated with the trains named "Andaman Exp". | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select railway.builder from railway join train on railway.railway_id = train.railway_id where train.name = 'Andaman Exp'
### Instruction:

Convert text to sql: Show id and location of railways that are associated with more than one train. | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select train.railway_id , railway.location from railway join train on railway.railway_id = train.railway_id group by train.railway_id having count ( * ) > 1

### Instruction:

Convert text to sql: Show the id and builder of the railway that are associated with the most trains. | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select train.railway_id , railway.builder from railway join train on railway.railway_id = train.railway_id group by train.railway_id order by count ( * ) desc limit 1

### Instruction:

Convert text to sql: Show different builders of railways, along with the corresponding number of railways using each builder. | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select builder , count ( * ) from railway group by builder

### Instruction:

Convert text to sql: Show the most common builder of railways. | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select builder from railway group by builder order by count ( * ) desc limit 1
### Instruction:

Convert text to sql: Show different locations of railways along with the corresponding number of railways at each location. | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select location , count ( * ) from railway group by location

### Instruction:

Convert text to sql: Show the locations that have more than one railways. | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select location from railway group by location having count ( * ) > 1

### Instruction:

Convert text to sql: List the object number of railways that do not have any trains. | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select objectnumber from railway where railway_id not in ( select railway_id from train )

### Instruction:

Convert text to sql: Show the countries that have both managers of age above 50 and managers of age below 46. | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select country from manager where age > 50 intersect select country from manager where age < 46

### Instruction:

Convert text to sql: Show the distinct countries of managers. | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select distinct country from manager
### Instruction:

Convert text to sql: Show the working years of managers in descending order of their level. | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select working_year_starts from manager order by level desc

### Instruction:

Convert text to sql: Show the countries that have managers of age above 50 or below 46. | railway : railway_id , railway , builder , built , wheels , location , objectnumber | train : train_id , train_num , name , from , arrival , railway_id | manager : manager_id , name , country , working_year_starts , age , level | railway_manage : railway_id , manager_id , from_year | train.railway_id = railway.railway_id | railway_manage.railway_id = railway.railway_id | railway_manage.manager_id = manager.manager_id | 

### Response:

select country from manager where age > 50 or age < 46
### Instruction:

Convert text to sql: How many addresses are there in country USA? | addresses : address_id , line_1_number_building , city , zip_postcode , state_province_county , country | products : product_id , product_type_code , product_name , product_price | customers : customer_id , payment_method_code , customer_number , customer_name , customer_address , customer_phone , customer_email | contacts : contact_id , customer_id , gender , first_name , last_name , contact_phone | customer_address_history : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_date , order_status_code | order_items : order_item_id , order_id , product_id , order_quantity | customer_address_history.address_id = addresses.address_id | customer_address_history.customer_id = customers.customer_id | customer_orders.customer_id = customers.customer_id | order_items.order_id = customer_orders.order_id | order_items.product_id = products.product_id | 

### Response:

select count ( * ) from addresses where country = 'USA'

### Instruction:

Convert text to sql: Show all distinct cities in the address record. | addresses : address_id , line_1_number_building , city , zip_postcode , state_province_county , country | products : product_id , product_type_code , product_name , product_price | customers : customer_id , payment_method_code , customer_number , customer_name , customer_address , customer_phone , customer_email | contacts : contact_id , customer_id , gender , first_name , last_name , contact_phone | customer_address_history : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_date , order_status_code | order_items : order_item_id , order_id , product_id , order_quantity | customer_address_history.address_id = addresses.address_id | customer_address_history.customer_id = customers.customer_id | customer_orders.customer_id = customers.customer_id | order_items.order_id = customer_orders.order_id | order_items.product_id = products.product_id | 

### Response:

select distinct city from addresses
### Instruction:

Convert text to sql: Show each state and the number of addresses in each state. | addresses : address_id , line_1_number_building , city , zip_postcode , state_province_county , country | products : product_id , product_type_code , product_name , product_price | customers : customer_id , payment_method_code , customer_number , customer_name , customer_address , customer_phone , customer_email | contacts : contact_id , customer_id , gender , first_name , last_name , contact_phone | customer_address_history : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_date , order_status_code | order_items : order_item_id , order_id , product_id , order_quantity | customer_address_history.address_id = addresses.address_id | customer_address_history.customer_id = customers.customer_id | customer_orders.customer_id = customers.customer_id | order_items.order_id = customer_orders.order_id | order_items.product_id = products.product_id | 

### Response:

select state_province_county , count ( * ) from addresses group by state_province_county

### Instruction:

Convert text to sql: Show names and phones of customers who do not have address information. | addresses : address_id , line_1_number_building , city , zip_postcode , state_province_county , country | products : product_id , product_type_code , product_name , product_price | customers : customer_id , payment_method_code , customer_number , customer_name , customer_address , customer_phone , customer_email | contacts : contact_id , customer_id , gender , first_name , last_name , contact_phone | customer_address_history : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_date , order_status_code | order_items : order_item_id , order_id , product_id , order_quantity | customer_address_history.address_id = addresses.address_id | customer_address_history.customer_id = customers.customer_id | customer_orders.customer_id = customers.customer_id | order_items.order_id = customer_orders.order_id | order_items.product_id = products.product_id | 

### Response:

select customer_name , customer_phone from customers where customer_id not in ( select customer_id from customer_address_history )
### Instruction:

Convert text to sql: Show the name of the customer who has the most orders. | addresses : address_id , line_1_number_building , city , zip_postcode , state_province_county , country | products : product_id , product_type_code , product_name , product_price | customers : customer_id , payment_method_code , customer_number , customer_name , customer_address , customer_phone , customer_email | contacts : contact_id , customer_id , gender , first_name , last_name , contact_phone | customer_address_history : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_date , order_status_code | order_items : order_item_id , order_id , product_id , order_quantity | customer_address_history.address_id = addresses.address_id | customer_address_history.customer_id = customers.customer_id | customer_orders.customer_id = customers.customer_id | order_items.order_id = customer_orders.order_id | order_items.product_id = products.product_id | 

### Response:

select customers.customer_name from customers join customer_orders on customers.customer_id = customer_orders.customer_id group by customers.customer_id order by count ( * ) desc limit 1

### Instruction:

Convert text to sql: Show the product type codes which have at least two products. | addresses : address_id , line_1_number_building , city , zip_postcode , state_province_county , country | products : product_id , product_type_code , product_name , product_price | customers : customer_id , payment_method_code , customer_number , customer_name , customer_address , customer_phone , customer_email | contacts : contact_id , customer_id , gender , first_name , last_name , contact_phone | customer_address_history : customer_id , address_id , date_from , date_to | customer_orders : order_id , customer_id , order_date , order_status_code | order_items : order_item_id , order_id , product_id , order_quantity | customer_address_history.address_id = addresses.address_id | customer_address_history.customer_id = customers.customer_id | customer_orders.customer_id = customers.customer_id | order_items.order_id = customer_orders.order_id | order_items.product_id = products.product_id | 

### Response:

select product_type_code from products group by product_type_code having count ( * ) >= 2