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

Convert text to sql: Find all the policy type codes associated with the customer "Dayana Robel" | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select policy_type_code from policies join customers on policies.customer_id = customers.customer_id where customers.customer_details = 'Dayana Robel'

### Instruction:

Convert text to sql: What are the type codes of the policies used by the customer "Dayana Robel"? | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select policy_type_code from policies join customers on policies.customer_id = customers.customer_id where customers.customer_details = 'Dayana Robel'
### Instruction:

Convert text to sql: Which type of policy is most frequently used? Give me the policy type code. | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select policy_type_code from policies group by policy_type_code order by count ( * ) desc limit 1

### Instruction:

Convert text to sql: Find the type code of the most frequently used policy. | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select policy_type_code from policies group by policy_type_code order by count ( * ) desc limit 1
### Instruction:

Convert text to sql: Find all the policy types that are used by more than 2 customers. | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select policy_type_code from policies group by policy_type_code having count ( * ) > 2

### Instruction:

Convert text to sql: Which types of policy are chosen by more than 2 customers? Give me the policy type codes. | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select policy_type_code from policies group by policy_type_code having count ( * ) > 2
### Instruction:

Convert text to sql: Find the total and average amount paid in claim headers. | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select sum ( amount_piad ) , avg ( amount_piad ) from claim_headers

### Instruction:

Convert text to sql: What are the total amount and average amount paid in claim headers? | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select sum ( amount_piad ) , avg ( amount_piad ) from claim_headers
### Instruction:

Convert text to sql: Find the total amount claimed in the most recently created document. | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select sum ( claim_headers.amount_claimed ) from claim_headers join claims_documents on claim_headers.claim_header_id = claims_documents.claim_id where claims_documents.created_date = ( select created_date from claims_documents order by created_date asc limit 1 )

### Instruction:

Convert text to sql: How much amount in total were claimed in the most recently created document? | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select sum ( claim_headers.amount_claimed ) from claim_headers join claims_documents on claim_headers.claim_header_id = claims_documents.claim_id where claims_documents.created_date = ( select created_date from claims_documents order by created_date asc limit 1 )
### Instruction:

Convert text to sql: What is the name of the customer who has made the largest amount of claim in a single claim? | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select customers.customer_details from claim_headers join policies on claim_headers.policy_id = policies.policy_id join customers on policies.customer_id = customers.customer_id where claim_headers.amount_claimed = ( select max ( amount_claimed ) from claim_headers )

### Instruction:

Convert text to sql: Which customer made the largest amount of claim in a single claim? Return the customer details. | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select customers.customer_details from claim_headers join policies on claim_headers.policy_id = policies.policy_id join customers on policies.customer_id = customers.customer_id where claim_headers.amount_claimed = ( select max ( amount_claimed ) from claim_headers )
### Instruction:

Convert text to sql: What is the name of the customer who has made the minimum amount of payment in one claim? | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select customers.customer_details from claim_headers join policies on claim_headers.policy_id = policies.policy_id join customers on policies.customer_id = customers.customer_id where claim_headers.amount_piad = ( select min ( amount_piad ) from claim_headers )

### Instruction:

Convert text to sql: Which customer made the smallest amount of claim in one claim? Return the customer details. | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select customers.customer_details from claim_headers join policies on claim_headers.policy_id = policies.policy_id join customers on policies.customer_id = customers.customer_id where claim_headers.amount_piad = ( select min ( amount_piad ) from claim_headers )
### Instruction:

Convert text to sql: Find the names of customers who have no policies associated. | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select customer_details from customers except select customers.customer_details from policies join customers on policies.customer_id = customers.customer_id

### Instruction:

Convert text to sql: What are the names of customers who do not have any policies? | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select customer_details from customers except select customers.customer_details from policies join customers on policies.customer_id = customers.customer_id
### Instruction:

Convert text to sql: How many claim processing stages are there in total? | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select count ( * ) from claims_processing_stages

### Instruction:

Convert text to sql: Find the number of distinct stages in claim processing. | customers : customer_id , customer_details | staff : staff_id , staff_details | policies : policy_id , customer_id , policy_type_code , start_date , end_date | claim_headers : claim_header_id , claim_status_code , claim_type_code , policy_id , date_of_claim , date_of_settlement , amount_claimed , amount_piad | claims_documents : claim_id , document_type_code , created_by_staff_id , created_date | claims_processing_stages : claim_stage_id , next_claim_stage_id , claim_status_name , claim_status_description | claims_processing : claim_processing_id , claim_id , claim_outcome_code , claim_stage_id , staff_id | policies.customer_id = customers.customer_id | claim_headers.policy_id = policies.policy_id | claims_documents.created_by_staff_id = staff.staff_id | claims_documents.claim_id = claim_headers.claim_header_id | claims_processing.staff_id = staff.staff_id | claims_processing.claim_id = claim_headers.claim_header_id | 

### Response:

select count ( * ) from claims_processing_stages