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

Convert text to sql: Find the name of customers who have loans of both Mortgages and Auto. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select customer.cust_name from customer join loan on customer.cust_id = loan.cust_id where loan_type = 'Mortgages' intersect select customer.cust_name from customer join loan on customer.cust_id = loan.cust_id where loan_type = 'Auto'

### Instruction:

Convert text to sql: What are the names of customers who have taken both Mortgage and Auto loans? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select customer.cust_name from customer join loan on customer.cust_id = loan.cust_id where loan_type = 'Mortgages' intersect select customer.cust_name from customer join loan on customer.cust_id = loan.cust_id where loan_type = 'Auto'

### Instruction:

Convert text to sql: Find the name of customers whose credit score is below the average credit scores of all customers. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select cust_name from customer where credit_score < ( select avg ( credit_score ) from customer )

### Instruction:

Convert text to sql: What are the names of customers with credit score less than the average credit score across customers? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select cust_name from customer where credit_score < ( select avg ( credit_score ) from customer )

### Instruction:

Convert text to sql: Find the branch name of the bank that has the most number of customers. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select bname from bank order by no_of_customers desc limit 1
### Instruction:

Convert text to sql: What is the name of the bank branch with the greatest number of customers? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select bname from bank order by no_of_customers desc limit 1

### Instruction:

Convert text to sql: Find the name of customer who has the lowest credit score. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select cust_name from customer order by credit_score asc limit 1

### Instruction:

Convert text to sql: What is the name of the customer with the worst credit score? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select cust_name from customer order by credit_score asc limit 1

### Instruction:

Convert text to sql: Find the name, account type, and account balance of the customer who has the highest credit score. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select cust_name , acc_type , acc_bal from customer order by credit_score desc limit 1

### Instruction:

Convert text to sql: What is the name, account type, and account balance corresponding to the customer with the highest credit score? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select cust_name , acc_type , acc_bal from customer order by credit_score desc limit 1

### Instruction:

Convert text to sql: Find the name of customer who has the highest amount of loans. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select customer.cust_name from customer join loan on customer.cust_id = loan.cust_id group by customer.cust_name order by sum ( loan.amount ) desc limit 1
### Instruction:

Convert text to sql: What is the name of the customer who has greatest total loan amount? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select customer.cust_name from customer join loan on customer.cust_id = loan.cust_id group by customer.cust_name order by sum ( loan.amount ) desc limit 1

### Instruction:

Convert text to sql: Find the state which has the most number of customers. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select state from bank group by state order by sum ( no_of_customers ) desc limit 1

### Instruction:

Convert text to sql: Which state has the greatest total number of bank customers? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select state from bank group by state order by sum ( no_of_customers ) desc limit 1

### Instruction:

Convert text to sql: For each account type, find the average account balance of customers with credit score lower than 50. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select avg ( acc_bal ) , acc_type from customer where credit_score < 50 group by acc_type

### Instruction:

Convert text to sql: What is the average account balance of customers with credit score below 50 for the different account types? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select avg ( acc_bal ) , acc_type from customer where credit_score < 50 group by acc_type

### Instruction:

Convert text to sql: For each state, find the total account balance of customers whose credit score is above 100. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select sum ( acc_bal ) , state from customer where credit_score > 100 group by state
### Instruction:

Convert text to sql: What is the total account balance for customers with a credit score of above 100 for the different states? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select sum ( acc_bal ) , state from customer where credit_score > 100 group by state

### Instruction:

Convert text to sql: Find the total amount of loans offered by each bank branch. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select sum ( amount ) , bank.bname from bank join loan on bank.branch_id = loan.branch_id group by bank.bname

### Instruction:

Convert text to sql: What are the names of the different bank branches, and what are their total loan amounts? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select sum ( amount ) , bank.bname from bank join loan on bank.branch_id = loan.branch_id group by bank.bname

### Instruction:

Convert text to sql: Find the name of customers who have more than one loan. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select customer.cust_name from customer join loan on customer.cust_id = loan.cust_id group by customer.cust_name having count ( * ) > 1

### Instruction:

Convert text to sql: What are the names of customers who have taken out more than one loan? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select customer.cust_name from customer join loan on customer.cust_id = loan.cust_id group by customer.cust_name having count ( * ) > 1
### Instruction:

Convert text to sql: Find the name and account balance of the customers who have loans with a total amount of more than 5000. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select customer.cust_name , customer.acc_type from customer join loan on customer.cust_id = loan.cust_id group by customer.cust_name having sum ( loan.amount ) > 5000

### Instruction:

Convert text to sql: What are the names and account balances for customers who have taken a total amount of more than 5000 in loans? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select customer.cust_name , customer.acc_type from customer join loan on customer.cust_id = loan.cust_id group by customer.cust_name having sum ( loan.amount ) > 5000

### Instruction:

Convert text to sql: Find the name of bank branch that provided the greatest total amount of loans. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select bank.bname from bank join loan on bank.branch_id = loan.branch_id group by bank.bname order by sum ( loan.amount ) desc limit 1

### Instruction:

Convert text to sql: What is the name of the bank branch that has lent the greatest amount? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select bank.bname from bank join loan on bank.branch_id = loan.branch_id group by bank.bname order by sum ( loan.amount ) desc limit 1

### Instruction:

Convert text to sql: Find the name of bank branch that provided the greatest total amount of loans to customers with credit score is less than 100. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select bank.bname from loan join bank on loan.branch_id = bank.branch_id join customer on loan.cust_id = customer.cust_id where customer.credit_score < 100 group by bank.bname order by sum ( loan.amount ) desc limit 1
### Instruction:

Convert text to sql: What is the name of the bank branch that has lended the largest total amount in loans, specifically to customers with credit scores below 100? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select bank.bname from loan join bank on loan.branch_id = bank.branch_id join customer on loan.cust_id = customer.cust_id where customer.credit_score < 100 group by bank.bname order by sum ( loan.amount ) desc limit 1

### Instruction:

Convert text to sql: Find the name of bank branches that provided some loans. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select distinct bank.bname from bank join loan on bank.branch_id = loan.branch_id

### Instruction:

Convert text to sql: What are the names of the different banks that have provided loans? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select distinct bank.bname from bank join loan on bank.branch_id = loan.branch_id

### Instruction:

Convert text to sql: Find the name and credit score of the customers who have some loans. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select distinct customer.cust_name , customer.credit_score from customer join loan on customer.cust_id = loan.cust_id

### Instruction:

Convert text to sql: What are the different names and credit scores of customers who have taken a loan? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select distinct customer.cust_name , customer.credit_score from customer join loan on customer.cust_id = loan.cust_id
### Instruction:

Convert text to sql: Find the the name of the customers who have a loan with amount more than 3000. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select customer.cust_name from customer join loan on customer.cust_id = loan.cust_id where amount > 3000

### Instruction:

Convert text to sql: What are the names of customers who have a loan of more than 3000 in amount? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select customer.cust_name from customer join loan on customer.cust_id = loan.cust_id where amount > 3000

### Instruction:

Convert text to sql: Find the city and name of bank branches that provide business loans. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select bank.bname , bank.city from bank join loan on bank.branch_id = loan.branch_id where loan.loan_type = 'Business'

### Instruction:

Convert text to sql: What are the names and cities of bank branches that offer loans for business? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select bank.bname , bank.city from bank join loan on bank.branch_id = loan.branch_id where loan.loan_type = 'Business'

### Instruction:

Convert text to sql: Find the names of bank branches that have provided a loan to any customer whose credit score is below 100. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select bank.bname from loan join bank on loan.branch_id = bank.branch_id join customer on loan.cust_id = customer.cust_id where customer.credit_score < 100
### Instruction:

Convert text to sql: What are the names of banks that have loaned money to customers with credit scores below 100? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select bank.bname from loan join bank on loan.branch_id = bank.branch_id join customer on loan.cust_id = customer.cust_id where customer.credit_score < 100

### Instruction:

Convert text to sql: Find the total amount of loans provided by bank branches in the state of New York. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select sum ( loan.amount ) from bank join loan on bank.branch_id = loan.branch_id where bank.state = 'New York'

### Instruction:

Convert text to sql: What is the total amount of money loaned by banks in New York state? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select sum ( loan.amount ) from bank join loan on bank.branch_id = loan.branch_id where bank.state = 'New York'

### Instruction:

Convert text to sql: Find the average credit score of the customers who have some loan. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select avg ( credit_score ) from customer where cust_id in ( select cust_id from loan )

### Instruction:

Convert text to sql: What is the average credit score for customers who have taken a loan? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select avg ( credit_score ) from customer where cust_id in ( select cust_id from loan )
### Instruction:

Convert text to sql: Find the average credit score of the customers who do not have any loan. | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select avg ( credit_score ) from customer where cust_id not in ( select cust_id from loan )

### Instruction:

Convert text to sql: What is the average credit score for customers who have never taken a loan? | bank : branch_id , bname , no_of_customers , city , state | customer : cust_id , cust_name , acc_type , acc_bal , no_of_loans , credit_score , branch_id , state | loan : loan_id , loan_type , cust_id , branch_id , amount | customer.branch_id = bank.branch_id | loan.branch_id = bank.branch_id | 

### Response:

select avg ( credit_score ) from customer where cust_id not in ( select cust_id from loan )