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

Convert text to sql: Which company started the earliest the maintenance contract? Show the company name. | third_party_companies : company_id , company_type , company_name , company_address , other_company_details | maintenance_contracts : maintenance_contract_id , maintenance_contract_company_id , contract_start_date , contract_end_date , other_contract_details | parts : part_id , part_name , chargeable_yn , chargeable_amount , other_part_details | skills : skill_id , skill_code , skill_description | staff : staff_id , staff_name , gender , other_staff_details | assets : asset_id , maintenance_contract_id , supplier_company_id , asset_details , asset_make , asset_model , asset_acquired_date , asset_disposed_date , other_asset_details | asset_parts : asset_id , part_id | maintenance_engineers : engineer_id , company_id , first_name , last_name , other_details | engineer_skills : engineer_id , skill_id | fault_log : fault_log_entry_id , asset_id , recorded_by_staff_id , fault_log_entry_datetime , fault_description , other_fault_details | engineer_visits : engineer_visit_id , contact_staff_id , engineer_id , fault_log_entry_id , fault_status , visit_start_datetime , visit_end_datetime , other_visit_details | part_faults : part_fault_id , part_id , fault_short_name , fault_description , other_fault_details | fault_log_parts : fault_log_entry_id , part_fault_id , fault_status | skills_required_to_fix : part_fault_id , skill_id | maintenance_contracts.maintenance_contract_company_id = third_party_companies.company_id | assets.supplier_company_id = third_party_companies.company_id | assets.maintenance_contract_id = maintenance_contracts.maintenance_contract_id | asset_parts.asset_id = assets.asset_id | asset_parts.part_id = parts.part_id | maintenance_engineers.company_id = third_party_companies.company_id | engineer_skills.skill_id = skills.skill_id | engineer_skills.engineer_id = maintenance_engineers.engineer_id | fault_log.recorded_by_staff_id = staff.staff_id | fault_log.asset_id = assets.asset_id | engineer_visits.contact_staff_id = staff.staff_id | engineer_visits.engineer_id = maintenance_engineers.engineer_id | engineer_visits.fault_log_entry_id = fault_log.fault_log_entry_id | part_faults.part_id = parts.part_id | fault_log_parts.fault_log_entry_id = fault_log.fault_log_entry_id | fault_log_parts.part_fault_id = part_faults.part_fault_id | skills_required_to_fix.skill_id = skills.skill_id | skills_required_to_fix.part_fault_id = part_faults.part_fault_id | 

### Response:

select third_party_companies.company_name from third_party_companies join maintenance_contracts on third_party_companies.company_id = maintenance_contracts.maintenance_contract_company_id order by maintenance_contracts.contract_start_date asc limit 1
### Instruction:

Convert text to sql: What is the type of the company who concluded its contracts most recently? | third_party_companies : company_id , company_type , company_name , company_address , other_company_details | maintenance_contracts : maintenance_contract_id , maintenance_contract_company_id , contract_start_date , contract_end_date , other_contract_details | parts : part_id , part_name , chargeable_yn , chargeable_amount , other_part_details | skills : skill_id , skill_code , skill_description | staff : staff_id , staff_name , gender , other_staff_details | assets : asset_id , maintenance_contract_id , supplier_company_id , asset_details , asset_make , asset_model , asset_acquired_date , asset_disposed_date , other_asset_details | asset_parts : asset_id , part_id | maintenance_engineers : engineer_id , company_id , first_name , last_name , other_details | engineer_skills : engineer_id , skill_id | fault_log : fault_log_entry_id , asset_id , recorded_by_staff_id , fault_log_entry_datetime , fault_description , other_fault_details | engineer_visits : engineer_visit_id , contact_staff_id , engineer_id , fault_log_entry_id , fault_status , visit_start_datetime , visit_end_datetime , other_visit_details | part_faults : part_fault_id , part_id , fault_short_name , fault_description , other_fault_details | fault_log_parts : fault_log_entry_id , part_fault_id , fault_status | skills_required_to_fix : part_fault_id , skill_id | maintenance_contracts.maintenance_contract_company_id = third_party_companies.company_id | assets.supplier_company_id = third_party_companies.company_id | assets.maintenance_contract_id = maintenance_contracts.maintenance_contract_id | asset_parts.asset_id = assets.asset_id | asset_parts.part_id = parts.part_id | maintenance_engineers.company_id = third_party_companies.company_id | engineer_skills.skill_id = skills.skill_id | engineer_skills.engineer_id = maintenance_engineers.engineer_id | fault_log.recorded_by_staff_id = staff.staff_id | fault_log.asset_id = assets.asset_id | engineer_visits.contact_staff_id = staff.staff_id | engineer_visits.engineer_id = maintenance_engineers.engineer_id | engineer_visits.fault_log_entry_id = fault_log.fault_log_entry_id | part_faults.part_id = parts.part_id | fault_log_parts.fault_log_entry_id = fault_log.fault_log_entry_id | fault_log_parts.part_fault_id = part_faults.part_fault_id | skills_required_to_fix.skill_id = skills.skill_id | skills_required_to_fix.part_fault_id = part_faults.part_fault_id | 

### Response:

select third_party_companies.company_type from third_party_companies join maintenance_contracts on third_party_companies.company_id = maintenance_contracts.maintenance_contract_company_id order by maintenance_contracts.contract_end_date desc limit 1
### Instruction:

Convert text to sql: Which gender makes up the majority of the staff? | third_party_companies : company_id , company_type , company_name , company_address , other_company_details | maintenance_contracts : maintenance_contract_id , maintenance_contract_company_id , contract_start_date , contract_end_date , other_contract_details | parts : part_id , part_name , chargeable_yn , chargeable_amount , other_part_details | skills : skill_id , skill_code , skill_description | staff : staff_id , staff_name , gender , other_staff_details | assets : asset_id , maintenance_contract_id , supplier_company_id , asset_details , asset_make , asset_model , asset_acquired_date , asset_disposed_date , other_asset_details | asset_parts : asset_id , part_id | maintenance_engineers : engineer_id , company_id , first_name , last_name , other_details | engineer_skills : engineer_id , skill_id | fault_log : fault_log_entry_id , asset_id , recorded_by_staff_id , fault_log_entry_datetime , fault_description , other_fault_details | engineer_visits : engineer_visit_id , contact_staff_id , engineer_id , fault_log_entry_id , fault_status , visit_start_datetime , visit_end_datetime , other_visit_details | part_faults : part_fault_id , part_id , fault_short_name , fault_description , other_fault_details | fault_log_parts : fault_log_entry_id , part_fault_id , fault_status | skills_required_to_fix : part_fault_id , skill_id | maintenance_contracts.maintenance_contract_company_id = third_party_companies.company_id | assets.supplier_company_id = third_party_companies.company_id | assets.maintenance_contract_id = maintenance_contracts.maintenance_contract_id | asset_parts.asset_id = assets.asset_id | asset_parts.part_id = parts.part_id | maintenance_engineers.company_id = third_party_companies.company_id | engineer_skills.skill_id = skills.skill_id | engineer_skills.engineer_id = maintenance_engineers.engineer_id | fault_log.recorded_by_staff_id = staff.staff_id | fault_log.asset_id = assets.asset_id | engineer_visits.contact_staff_id = staff.staff_id | engineer_visits.engineer_id = maintenance_engineers.engineer_id | engineer_visits.fault_log_entry_id = fault_log.fault_log_entry_id | part_faults.part_id = parts.part_id | fault_log_parts.fault_log_entry_id = fault_log.fault_log_entry_id | fault_log_parts.part_fault_id = part_faults.part_fault_id | skills_required_to_fix.skill_id = skills.skill_id | skills_required_to_fix.part_fault_id = part_faults.part_fault_id | 

### Response:

select gender from staff group by gender order by count ( * ) desc limit 1
### Instruction:

Convert text to sql: How many engineers did each staff contact? List both the contact staff name and number of engineers contacted. | third_party_companies : company_id , company_type , company_name , company_address , other_company_details | maintenance_contracts : maintenance_contract_id , maintenance_contract_company_id , contract_start_date , contract_end_date , other_contract_details | parts : part_id , part_name , chargeable_yn , chargeable_amount , other_part_details | skills : skill_id , skill_code , skill_description | staff : staff_id , staff_name , gender , other_staff_details | assets : asset_id , maintenance_contract_id , supplier_company_id , asset_details , asset_make , asset_model , asset_acquired_date , asset_disposed_date , other_asset_details | asset_parts : asset_id , part_id | maintenance_engineers : engineer_id , company_id , first_name , last_name , other_details | engineer_skills : engineer_id , skill_id | fault_log : fault_log_entry_id , asset_id , recorded_by_staff_id , fault_log_entry_datetime , fault_description , other_fault_details | engineer_visits : engineer_visit_id , contact_staff_id , engineer_id , fault_log_entry_id , fault_status , visit_start_datetime , visit_end_datetime , other_visit_details | part_faults : part_fault_id , part_id , fault_short_name , fault_description , other_fault_details | fault_log_parts : fault_log_entry_id , part_fault_id , fault_status | skills_required_to_fix : part_fault_id , skill_id | maintenance_contracts.maintenance_contract_company_id = third_party_companies.company_id | assets.supplier_company_id = third_party_companies.company_id | assets.maintenance_contract_id = maintenance_contracts.maintenance_contract_id | asset_parts.asset_id = assets.asset_id | asset_parts.part_id = parts.part_id | maintenance_engineers.company_id = third_party_companies.company_id | engineer_skills.skill_id = skills.skill_id | engineer_skills.engineer_id = maintenance_engineers.engineer_id | fault_log.recorded_by_staff_id = staff.staff_id | fault_log.asset_id = assets.asset_id | engineer_visits.contact_staff_id = staff.staff_id | engineer_visits.engineer_id = maintenance_engineers.engineer_id | engineer_visits.fault_log_entry_id = fault_log.fault_log_entry_id | part_faults.part_id = parts.part_id | fault_log_parts.fault_log_entry_id = fault_log.fault_log_entry_id | fault_log_parts.part_fault_id = part_faults.part_fault_id | skills_required_to_fix.skill_id = skills.skill_id | skills_required_to_fix.part_fault_id = part_faults.part_fault_id | 

### Response:

select staff.staff_name , count ( * ) from staff join engineer_visits on staff.staff_id = engineer_visits.contact_staff_id group by staff.staff_name
### Instruction:

Convert text to sql: Which assets did not incur any fault log? List the asset model. | third_party_companies : company_id , company_type , company_name , company_address , other_company_details | maintenance_contracts : maintenance_contract_id , maintenance_contract_company_id , contract_start_date , contract_end_date , other_contract_details | parts : part_id , part_name , chargeable_yn , chargeable_amount , other_part_details | skills : skill_id , skill_code , skill_description | staff : staff_id , staff_name , gender , other_staff_details | assets : asset_id , maintenance_contract_id , supplier_company_id , asset_details , asset_make , asset_model , asset_acquired_date , asset_disposed_date , other_asset_details | asset_parts : asset_id , part_id | maintenance_engineers : engineer_id , company_id , first_name , last_name , other_details | engineer_skills : engineer_id , skill_id | fault_log : fault_log_entry_id , asset_id , recorded_by_staff_id , fault_log_entry_datetime , fault_description , other_fault_details | engineer_visits : engineer_visit_id , contact_staff_id , engineer_id , fault_log_entry_id , fault_status , visit_start_datetime , visit_end_datetime , other_visit_details | part_faults : part_fault_id , part_id , fault_short_name , fault_description , other_fault_details | fault_log_parts : fault_log_entry_id , part_fault_id , fault_status | skills_required_to_fix : part_fault_id , skill_id | maintenance_contracts.maintenance_contract_company_id = third_party_companies.company_id | assets.supplier_company_id = third_party_companies.company_id | assets.maintenance_contract_id = maintenance_contracts.maintenance_contract_id | asset_parts.asset_id = assets.asset_id | asset_parts.part_id = parts.part_id | maintenance_engineers.company_id = third_party_companies.company_id | engineer_skills.skill_id = skills.skill_id | engineer_skills.engineer_id = maintenance_engineers.engineer_id | fault_log.recorded_by_staff_id = staff.staff_id | fault_log.asset_id = assets.asset_id | engineer_visits.contact_staff_id = staff.staff_id | engineer_visits.engineer_id = maintenance_engineers.engineer_id | engineer_visits.fault_log_entry_id = fault_log.fault_log_entry_id | part_faults.part_id = parts.part_id | fault_log_parts.fault_log_entry_id = fault_log.fault_log_entry_id | fault_log_parts.part_fault_id = part_faults.part_fault_id | skills_required_to_fix.skill_id = skills.skill_id | skills_required_to_fix.part_fault_id = part_faults.part_fault_id | 

### Response:

select asset_model from assets where asset_id not in ( select asset_id from fault_log )
### Instruction:

Convert text to sql: list the local authorities and services provided by all stations. | train : id , train_number , name , origin , destination , time , interval | station : id , network_name , services , local_authority | route : train_id , station_id | weekly_weather : station_id , day_of_week , high_temperature , low_temperature , precipitation , wind_speed_mph | route.station_id = station.id | route.train_id = train.id | weekly_weather.station_id = station.id | 

### Response:

select local_authority , services from station

### Instruction:

Convert text to sql: show all train numbers and names ordered by their time from early to late. | train : id , train_number , name , origin , destination , time , interval | station : id , network_name , services , local_authority | route : train_id , station_id | weekly_weather : station_id , day_of_week , high_temperature , low_temperature , precipitation , wind_speed_mph | route.station_id = station.id | route.train_id = train.id | weekly_weather.station_id = station.id | 

### Response:

select train_number , name from train order by time asc

### Instruction:

Convert text to sql: Give me the times and numbers of all trains that go to Chennai, ordered by time. | train : id , train_number , name , origin , destination , time , interval | station : id , network_name , services , local_authority | route : train_id , station_id | weekly_weather : station_id , day_of_week , high_temperature , low_temperature , precipitation , wind_speed_mph | route.station_id = station.id | route.train_id = train.id | weekly_weather.station_id = station.id | 

### Response:

select time , train_number from train where destination = 'Chennai' order by time asc

### Instruction:

Convert text to sql: How many trains have 'Express' in their names? | train : id , train_number , name , origin , destination , time , interval | station : id , network_name , services , local_authority | route : train_id , station_id | weekly_weather : station_id , day_of_week , high_temperature , low_temperature , precipitation , wind_speed_mph | route.station_id = station.id | route.train_id = train.id | weekly_weather.station_id = station.id | 

### Response:

select count ( * ) from train where name like '%Express%'

### Instruction:

Convert text to sql: Find the number and time of the train that goes from Chennai to Guruvayur. | train : id , train_number , name , origin , destination , time , interval | station : id , network_name , services , local_authority | route : train_id , station_id | weekly_weather : station_id , day_of_week , high_temperature , low_temperature , precipitation , wind_speed_mph | route.station_id = station.id | route.train_id = train.id | weekly_weather.station_id = station.id | 

### Response:

select train_number , time from train where origin = 'Chennai' and destination = 'Guruvayur'
### Instruction:

Convert text to sql: Find the number of trains starting from each origin. | train : id , train_number , name , origin , destination , time , interval | station : id , network_name , services , local_authority | route : train_id , station_id | weekly_weather : station_id , day_of_week , high_temperature , low_temperature , precipitation , wind_speed_mph | route.station_id = station.id | route.train_id = train.id | weekly_weather.station_id = station.id | 

### Response:

select origin , count ( * ) from train group by origin

### Instruction:

Convert text to sql: Find the name of the train whose route runs through greatest number of stations. | train : id , train_number , name , origin , destination , time , interval | station : id , network_name , services , local_authority | route : train_id , station_id | weekly_weather : station_id , day_of_week , high_temperature , low_temperature , precipitation , wind_speed_mph | route.station_id = station.id | route.train_id = train.id | weekly_weather.station_id = station.id | 

### Response:

select train.name from train join route on train.id = route.train_id group by route.train_id order by count ( * ) desc limit 1

### Instruction:

Convert text to sql: Find the number of trains for each station, as well as the station network name and services. | train : id , train_number , name , origin , destination , time , interval | station : id , network_name , services , local_authority | route : train_id , station_id | weekly_weather : station_id , day_of_week , high_temperature , low_temperature , precipitation , wind_speed_mph | route.station_id = station.id | route.train_id = train.id | weekly_weather.station_id = station.id | 

### Response:

select count ( * ) , station.network_name , station.services from station join route on station.id = route.station_id group by route.station_id

### Instruction:

Convert text to sql: What is the average high temperature for each day of week? | train : id , train_number , name , origin , destination , time , interval | station : id , network_name , services , local_authority | route : train_id , station_id | weekly_weather : station_id , day_of_week , high_temperature , low_temperature , precipitation , wind_speed_mph | route.station_id = station.id | route.train_id = train.id | weekly_weather.station_id = station.id | 

### Response:

select avg ( high_temperature ) , day_of_week from weekly_weather group by day_of_week

### Instruction:

Convert text to sql: Give me the maximum low temperature and average precipitation at the Amersham station. | train : id , train_number , name , origin , destination , time , interval | station : id , network_name , services , local_authority | route : train_id , station_id | weekly_weather : station_id , day_of_week , high_temperature , low_temperature , precipitation , wind_speed_mph | route.station_id = station.id | route.train_id = train.id | weekly_weather.station_id = station.id | 

### Response:

select max ( weekly_weather.low_temperature ) , avg ( weekly_weather.precipitation ) from weekly_weather join station on weekly_weather.station_id = station.id where station.network_name = 'Amersham'
### Instruction:

Convert text to sql: Find names and times of trains that run through stations for the local authority Chiltern. | train : id , train_number , name , origin , destination , time , interval | station : id , network_name , services , local_authority | route : train_id , station_id | weekly_weather : station_id , day_of_week , high_temperature , low_temperature , precipitation , wind_speed_mph | route.station_id = station.id | route.train_id = train.id | weekly_weather.station_id = station.id | 

### Response:

select train.name , train.time from station join route on station.id = route.station_id join train on route.train_id = train.id where station.local_authority = 'Chiltern'

### Instruction:

Convert text to sql: How many different services are provided by all stations? | train : id , train_number , name , origin , destination , time , interval | station : id , network_name , services , local_authority | route : train_id , station_id | weekly_weather : station_id , day_of_week , high_temperature , low_temperature , precipitation , wind_speed_mph | route.station_id = station.id | route.train_id = train.id | weekly_weather.station_id = station.id | 

### Response:

select count ( distinct services ) from station

### Instruction:

Convert text to sql: Find the id and local authority of the station with has the highest average high temperature. | train : id , train_number , name , origin , destination , time , interval | station : id , network_name , services , local_authority | route : train_id , station_id | weekly_weather : station_id , day_of_week , high_temperature , low_temperature , precipitation , wind_speed_mph | route.station_id = station.id | route.train_id = train.id | weekly_weather.station_id = station.id | 

### Response:

select station.id , station.local_authority from weekly_weather join station on weekly_weather.station_id = station.id group by weekly_weather.station_id order by avg ( high_temperature ) desc limit 1

### Instruction:

Convert text to sql: Find the id and local authority of the station whose maximum precipitation is higher than 50. | train : id , train_number , name , origin , destination , time , interval | station : id , network_name , services , local_authority | route : train_id , station_id | weekly_weather : station_id , day_of_week , high_temperature , low_temperature , precipitation , wind_speed_mph | route.station_id = station.id | route.train_id = train.id | weekly_weather.station_id = station.id | 

### Response:

select station.id , station.local_authority from weekly_weather join station on weekly_weather.station_id = station.id group by weekly_weather.station_id having max ( weekly_weather.precipitation ) > 50
### Instruction:

Convert text to sql: show the lowest low temperature and highest wind speed in miles per hour. | train : id , train_number , name , origin , destination , time , interval | station : id , network_name , services , local_authority | route : train_id , station_id | weekly_weather : station_id , day_of_week , high_temperature , low_temperature , precipitation , wind_speed_mph | route.station_id = station.id | route.train_id = train.id | weekly_weather.station_id = station.id | 

### Response:

select min ( low_temperature ) , max ( wind_speed_mph ) from weekly_weather

### Instruction:

Convert text to sql: Find the origins from which more than 1 train starts. | train : id , train_number , name , origin , destination , time , interval | station : id , network_name , services , local_authority | route : train_id , station_id | weekly_weather : station_id , day_of_week , high_temperature , low_temperature , precipitation , wind_speed_mph | route.station_id = station.id | route.train_id = train.id | weekly_weather.station_id = station.id | 

### Response:

select origin from train group by origin having count ( * ) > 1