db_id
stringlengths
4
31
SQL
stringlengths
18
1.45k
input_sequence
stringlengths
148
11k
question
stringlengths
16
325
sakila_1
select amount from payment order by amount desc limit 1
Question: what is the largest payment amount? | Tables: actor -> actor_id, first_name, last_name, last_update. address -> address_id, address, address2, district, city_id, postal_code, phone, last_update. category -> category_id, name, last_update. city -> city_id, city, country_id, last_update. country -> country_id, ...
what is the largest payment amount?
sakila_1
select amount from payment order by amount desc limit 1
Question: return the amount of the largest payment. | Tables: actor -> actor_id, first_name, last_name, last_update. address -> address_id, address, address2, district, city_id, postal_code, phone, last_update. category -> category_id, name, last_update. city -> city_id, city, country_id, last_update. country -> countr...
return the amount of the largest payment.
sakila_1
select t2.address from staff as t1 join address as t2 on t1.address_id = t2.address_id where t1.first_name = 'elsa'
Question: where does the staff member with the first name elsa live? | Tables: actor -> actor_id, first_name, last_name, last_update. address -> address_id, address, address2, district, city_id, postal_code, phone, last_update. category -> category_id, name, last_update. city -> city_id, city, country_id, last_update. ...
where does the staff member with the first name elsa live?
sakila_1
select t2.address from staff as t1 join address as t2 on t1.address_id = t2.address_id where t1.first_name = 'elsa'
Question: give the address of the staff member who has the first name elsa. | Tables: actor -> actor_id, first_name, last_name, last_update. address -> address_id, address, address2, district, city_id, postal_code, phone, last_update. category -> category_id, name, last_update. city -> city_id, city, country_id, last_u...
give the address of the staff member who has the first name elsa.
sakila_1
select first_name from customer where customer_id not in( select customer_id from rental where rental_date > '2005-08-23 02:06:01' )
Question: what are the first names of customers who have not rented any films after '2005-08-23 02:06:01'? | Tables: actor -> actor_id, first_name, last_name, last_update. address -> address_id, address, address2, district, city_id, postal_code, phone, last_update. category -> category_id, name, last_update. city -> ci...
what are the first names of customers who have not rented any films after '2005-08-23 02:06:01'?
sakila_1
select first_name from customer where customer_id not in( select customer_id from rental where rental_date > '2005-08-23 02:06:01' )
Question: return the first names of customers who did not rented a film after the date '2005-08-23 02:06:01'. | Tables: actor -> actor_id, first_name, last_name, last_update. address -> address_id, address, address2, district, city_id, postal_code, phone, last_update. category -> category_id, name, last_update. city ->...
return the first names of customers who did not rented a film after the date '2005-08-23 02:06:01'.
loan_1
select count(*) from bank
Question: how many bank branches are there? | Tables: 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. | Joins: customer.branch_ID = bank.branch_ID, loan.branch_...
how many bank branches are there?
loan_1
select count(*) from bank
Question: count the number of bank branches. | Tables: 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. | Joins: customer.branch_ID = bank.branch_ID, loan.branch...
count the number of bank branches.
loan_1
select sum(no_of_customers) from bank
Question: how many customers are there? | Tables: 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. | Joins: customer.branch_ID = bank.branch_ID, loan.branch_ID =...
how many customers are there?
loan_1
select sum(no_of_customers) from bank
Question: what is the total number of customers across banks? | Tables: 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. | Joins: customer.branch_ID = bank.branc...
what is the total number of customers across banks?
loan_1
select sum(no_of_customers) from bank where city = 'new york city'
Question: find the number of customers in the banks at new york city. | Tables: 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. | Joins: customer.branch_ID = ba...
find the number of customers in the banks at new york city.
loan_1
select sum(no_of_customers) from bank where city = 'new york city'
Question: what is the total number of customers who use banks in new york city? | Tables: 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. | Joins: customer.bran...
what is the total number of customers who use banks in new york city?
loan_1
select avg(no_of_customers) from bank where state = 'utah'
Question: find the average number of customers in all banks of utah state. | Tables: 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. | Joins: customer.branch_ID...
find the average number of customers in all banks of utah state.
loan_1
select avg(no_of_customers) from bank where state = 'utah'
Question: what is the average number of customers across banks in the state of utah? | Tables: 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. | Joins: customer...
what is the average number of customers across banks in the state of utah?
loan_1
select avg(no_of_customers) from bank
Question: find the average number of customers cross all banks. | Tables: 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. | Joins: customer.branch_ID = bank.bra...
find the average number of customers cross all banks.
loan_1
select avg(no_of_customers) from bank
Question: what is the average number of bank customers? | Tables: 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. | Joins: customer.branch_ID = bank.branch_ID, ...
what is the average number of bank customers?
loan_1
select city , state from bank where bname = 'morningside'
Question: find the city and state of the bank branch named morningside. | Tables: 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. | Joins: customer.branch_ID = ...
find the city and state of the bank branch named morningside.
loan_1
select city , state from bank where bname = 'morningside'
Question: what city and state is the bank with the name morningside in? | Tables: 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. | Joins: customer.branch_ID = ...
what city and state is the bank with the name morningside in?
loan_1
select bname from bank where state = 'new york'
Question: find the branch names of banks in the new york state. | Tables: 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. | Joins: customer.branch_ID = bank.bra...
find the branch names of banks in the new york state.
loan_1
select bname from bank where state = 'new york'
Question: what are the names of banks in the state of new york? | Tables: 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. | Joins: customer.branch_ID = bank.bra...
what are the names of banks in the state of new york?
loan_1
select cust_name from customer order by acc_bal
Question: list the name of all customers sorted by their account balance in ascending order. | Tables: 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. | Joins: ...
list the name of all customers sorted by their account balance in ascending order.
loan_1
select cust_name from customer order by acc_bal
Question: what are the names of all customers, ordered by account balance? | Tables: 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. | Joins: customer.branch_ID...
what are the names of all customers, ordered by account balance?
loan_1
select t1.cust_name from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id group by t1.cust_name order by sum(t2.amount)
Question: list the name of all different customers who have some loan sorted by their total loan amount. | Tables: 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, amoun...
list the name of all different customers who have some loan sorted by their total loan amount.
loan_1
select t1.cust_name from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id group by t1.cust_name order by sum(t2.amount)
Question: what are the names of the different customers who have taken out a loan, ordered by the total amount that they have taken? | Tables: 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_typ...
what are the names of the different customers who have taken out a loan, ordered by the total amount that they have taken?
loan_1
select state , acc_type , credit_score from customer where no_of_loans = 0
Question: find the state, account type, and credit score of the customer whose number of loan is 0. | Tables: 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. | ...
find the state, account type, and credit score of the customer whose number of loan is 0.
loan_1
select state , acc_type , credit_score from customer where no_of_loans = 0
Question: what are the states, account types, and credit scores for customers who have 0 loans? | Tables: 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. | Join...
what are the states, account types, and credit scores for customers who have 0 loans?
loan_1
select count(distinct city) from bank
Question: find the number of different cities which banks are located at. | Tables: 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. | Joins: customer.branch_ID ...
find the number of different cities which banks are located at.
loan_1
select count(distinct city) from bank
Question: in how many different cities are banks located? | Tables: 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. | Joins: customer.branch_ID = bank.branch_ID...
in how many different cities are banks located?
loan_1
select count(distinct state) from bank
Question: find the number of different states which banks are located at. | Tables: 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. | Joins: customer.branch_ID ...
find the number of different states which banks are located at.
loan_1
select count(distinct state) from bank
Question: in how many different states are banks located? | Tables: 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. | Joins: customer.branch_ID = bank.branch_ID...
in how many different states are banks located?
loan_1
select count(distinct acc_type) from customer
Question: how many distinct types of accounts are there? | Tables: 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. | Joins: customer.branch_ID = bank.branch_ID,...
how many distinct types of accounts are there?
loan_1
select count(distinct acc_type) from customer
Question: count the number of different account types. | Tables: 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. | Joins: customer.branch_ID = bank.branch_ID, l...
count the number of different account types.
loan_1
select cust_name , acc_bal from customer where cust_name like '%a%'
Question: find the name and account balance of the customer whose name includes the letter a. | Tables: 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. | Joins:...
find the name and account balance of the customer whose name includes the letter a.
loan_1
select cust_name , acc_bal from customer where cust_name like '%a%'
Question: what are the names and account balances of customers with the letter a in their names? | Tables: 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. | Joi...
what are the names and account balances of customers with the letter a in their names?
loan_1
select sum(acc_bal) from customer where state = 'utah' or state = 'texas'
Question: find the total account balance of each customer from utah or texas. | Tables: 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. | Joins: customer.branch...
find the total account balance of each customer from utah or texas.
loan_1
select sum(acc_bal) from customer where state = 'utah' or state = 'texas'
Question: what are the total account balances for each customer from utah or texas? | Tables: 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. | Joins: customer....
what are the total account balances for each customer from utah or texas?
loan_1
select cust_name from customer where acc_type = 'saving' intersect select cust_name from customer where acc_type = 'checking'
Question: find the name of customers who have both saving and checking account types. | Tables: 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. | Joins: custome...
find the name of customers who have both saving and checking account types.
loan_1
select cust_name from customer where acc_type = 'saving' intersect select cust_name from customer where acc_type = 'checking'
Question: what are the names of customers who have both savings and checking accounts? | Tables: 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. | Joins: custom...
what are the names of customers who have both savings and checking accounts?
loan_1
select cust_name from customer except select cust_name from customer where acc_type = 'saving'
Question: find the name of customers who do not have an saving account. | Tables: 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. | Joins: customer.branch_ID = ...
find the name of customers who do not have an saving account.
loan_1
select cust_name from customer except select cust_name from customer where acc_type = 'saving'
Question: what are the names of customers who do not have saving accounts? | Tables: 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. | Joins: customer.branch_ID...
what are the names of customers who do not have saving accounts?
loan_1
select cust_name from customer except select t1.cust_name from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id where t2.loan_type = 'mortgages'
Question: find the name of customers who do not have a loan with a type of mortgages. | Tables: 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. | Joins: custome...
find the name of customers who do not have a loan with a type of mortgages.
loan_1
select cust_name from customer except select t1.cust_name from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id where t2.loan_type = 'mortgages'
Question: what are the names of customers who have not taken a mortage loan? | Tables: 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. | Joins: customer.branch_...
what are the names of customers who have not taken a mortage loan?
loan_1
select t1.cust_name from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id where loan_type = 'mortgages' intersect select t1.cust_name from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id where loan_type = 'auto'
Question: find the name of customers who have loans of both mortgages and auto. | Tables: 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. | Joins: customer.bran...
find the name of customers who have loans of both mortgages and auto.
loan_1
select t1.cust_name from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id where loan_type = 'mortgages' intersect select t1.cust_name from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id where loan_type = 'auto'
Question: what are the names of customers who have taken both mortgage and auto loans? | Tables: 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. | Joins: custom...
what are the names of customers who have taken both mortgage and auto loans?
loan_1
select cust_name from customer where credit_score < (select avg(credit_score) from customer)
Question: find the name of customers whose credit score is below the average credit scores of all customers. | Tables: 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, a...
find the name of customers whose credit score is below the average credit scores of all customers.
loan_1
select cust_name from customer where credit_score < (select avg(credit_score) from customer)
Question: what are the names of customers with credit score less than the average credit score across customers? | Tables: 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_I...
what are the names of customers with credit score less than the average credit score across customers?
loan_1
select bname from bank order by no_of_customers desc limit 1
Question: find the branch name of the bank that has the most number of customers. | Tables: 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. | Joins: customer.br...
find the branch name of the bank that has the most number of customers.
loan_1
select bname from bank order by no_of_customers desc limit 1
Question: what is the name of the bank branch with the greatest number of customers? | Tables: 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. | Joins: customer...
what is the name of the bank branch with the greatest number of customers?
loan_1
select cust_name from customer order by credit_score limit 1
Question: find the name of customer who has the lowest credit score. | Tables: 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. | Joins: customer.branch_ID = ban...
find the name of customer who has the lowest credit score.
loan_1
select cust_name from customer order by credit_score limit 1
Question: what is the name of the customer with the worst credit score? | Tables: 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. | Joins: customer.branch_ID = ...
what is the name of the customer with the worst credit score?
loan_1
select cust_name , acc_type , acc_bal from customer order by credit_score desc limit 1
Question: find the name, account type, and account balance of the customer who has the highest credit score. | Tables: 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, a...
find the name, account type, and account balance of the customer who has the highest credit score.
loan_1
select cust_name , acc_type , acc_bal from customer order by credit_score desc limit 1
Question: what is the name, account type, and account balance corresponding to the customer with the highest credit score? | Tables: 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...
what is the name, account type, and account balance corresponding to the customer with the highest credit score?
loan_1
select t1.cust_name from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id group by t1.cust_name order by sum(t2.amount) desc limit 1
Question: find the name of customer who has the highest amount of loans. | Tables: 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. | Joins: customer.branch_ID =...
find the name of customer who has the highest amount of loans.
loan_1
select t1.cust_name from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id group by t1.cust_name order by sum(t2.amount) desc limit 1
Question: what is the name of the customer who has greatest total loan amount? | Tables: 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. | Joins: customer.branc...
what is the name of the customer who has greatest total loan amount?
loan_1
select state from bank group by state order by sum(no_of_customers) desc limit 1
Question: find the state which has the most number of customers. | Tables: 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. | Joins: customer.branch_ID = bank.br...
find the state which has the most number of customers.
loan_1
select state from bank group by state order by sum(no_of_customers) desc limit 1
Question: which state has the greatest total number of bank customers? | Tables: 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. | Joins: customer.branch_ID = b...
which state has the greatest total number of bank customers?
loan_1
select avg(acc_bal) , acc_type from customer where credit_score < 50 group by acc_type
Question: for each account type, find the average account balance of customers with credit score lower than 50. | Tables: 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...
for each account type, find the average account balance of customers with credit score lower than 50.
loan_1
select avg(acc_bal) , acc_type from customer where credit_score < 50 group by acc_type
Question: what is the average account balance of customers with credit score below 50 for the different account types? | Tables: 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, br...
what is the average account balance of customers with credit score below 50 for the different account types?
loan_1
select sum(acc_bal) , state from customer where credit_score > 100 group by state
Question: for each state, find the total account balance of customers whose credit score is above 100. | Tables: 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....
for each state, find the total account balance of customers whose credit score is above 100.
loan_1
select sum(acc_bal) , state from customer where credit_score > 100 group by state
Question: what is the total account balance for customers with a credit score of above 100 for the different states? | Tables: 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, bran...
what is the total account balance for customers with a credit score of above 100 for the different states?
loan_1
select sum(amount) , t1.bname from bank as t1 join loan as t2 on t1.branch_id = t2.branch_id group by t1.bname
Question: find the total amount of loans offered by each bank branch. | Tables: 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. | Joins: customer.branch_ID = ba...
find the total amount of loans offered by each bank branch.
loan_1
select sum(amount) , t1.bname from bank as t1 join loan as t2 on t1.branch_id = t2.branch_id group by t1.bname
Question: what are the names of the different bank branches, and what are their total loan amounts? | Tables: 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. | ...
what are the names of the different bank branches, and what are their total loan amounts?
loan_1
select t1.cust_name from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id group by t1.cust_name having count(*) > 1
Question: find the name of customers who have more than one loan. | Tables: 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. | Joins: customer.branch_ID = bank.b...
find the name of customers who have more than one loan.
loan_1
select t1.cust_name from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id group by t1.cust_name having count(*) > 1
Question: what are the names of customers who have taken out more than one loan? | Tables: 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. | Joins: customer.bra...
what are the names of customers who have taken out more than one loan?
loan_1
select t1.cust_name , t1.acc_type from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id group by t1.cust_name having sum(t2.amount) > 5000
Question: find the name and account balance of the customers who have loans with a total amount of more than 5000. | Tables: 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...
find the name and account balance of the customers who have loans with a total amount of more than 5000.
loan_1
select t1.cust_name , t1.acc_type from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id group by t1.cust_name having sum(t2.amount) > 5000
Question: what are the names and account balances for customers who have taken a total amount of more than 5000 in loans? | Tables: 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,...
what are the names and account balances for customers who have taken a total amount of more than 5000 in loans?
loan_1
select t1.bname from bank as t1 join loan as t2 on t1.branch_id = t2.branch_id group by t1.bname order by sum(t2.amount) desc limit 1
Question: find the name of bank branch that provided the greatest total amount of loans. | Tables: 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. | Joins: cust...
find the name of bank branch that provided the greatest total amount of loans.
loan_1
select t1.bname from bank as t1 join loan as t2 on t1.branch_id = t2.branch_id group by t1.bname order by sum(t2.amount) desc limit 1
Question: what is the name of the bank branch that has lent the greatest amount? | Tables: 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. | Joins: customer.bra...
what is the name of the bank branch that has lent the greatest amount?
loan_1
select t2.bname from loan as t1 join bank as t2 on t1.branch_id = t2.branch_id join customer as t3 on t1.cust_id = t3.cust_id where t3.credit_score < 100 group by t2.bname order by sum(t1.amount) desc limit 1
Question: find the name of bank branch that provided the greatest total amount of loans to customers with credit score is less than 100. | Tables: 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...
find the name of bank branch that provided the greatest total amount of loans to customers with credit score is less than 100.
loan_1
select t2.bname from loan as t1 join bank as t2 on t1.branch_id = t2.branch_id join customer as t3 on t1.cust_id = t3.cust_id where t3.credit_score < 100 group by t2.bname order by sum(t1.amount) desc limit 1
Question: 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? | Tables: 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 ...
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?
loan_1
select distinct t1.bname from bank as t1 join loan as t2 on t1.branch_id = t2.branch_id
Question: find the name of bank branches that provided some loans. | Tables: 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. | Joins: customer.branch_ID = bank....
find the name of bank branches that provided some loans.
loan_1
select distinct t1.bname from bank as t1 join loan as t2 on t1.branch_id = t2.branch_id
Question: what are the names of the different banks that have provided loans? | Tables: 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. | Joins: customer.branch...
what are the names of the different banks that have provided loans?
loan_1
select distinct t1.cust_name , t1.credit_score from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id
Question: find the name and credit score of the customers who have some loans. | Tables: 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. | Joins: customer.branc...
find the name and credit score of the customers who have some loans.
loan_1
select distinct t1.cust_name , t1.credit_score from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id
Question: what are the different names and credit scores of customers who have taken a loan? | Tables: 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. | Joins: ...
what are the different names and credit scores of customers who have taken a loan?
loan_1
select t1.cust_name from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id where amount > 3000
Question: find the the name of the customers who have a loan with amount more than 3000. | Tables: 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. | Joins: cust...
find the the name of the customers who have a loan with amount more than 3000.
loan_1
select t1.cust_name from customer as t1 join loan as t2 on t1.cust_id = t2.cust_id where amount > 3000
Question: what are the names of customers who have a loan of more than 3000 in amount? | Tables: 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. | Joins: custom...
what are the names of customers who have a loan of more than 3000 in amount?
loan_1
select t1.bname , t1.city from bank as t1 join loan as t2 on t1.branch_id = t2.branch_id where t2.loan_type = 'business'
Question: find the city and name of bank branches that provide business loans. | Tables: 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. | Joins: customer.branc...
find the city and name of bank branches that provide business loans.
loan_1
select t1.bname , t1.city from bank as t1 join loan as t2 on t1.branch_id = t2.branch_id where t2.loan_type = 'business'
Question: what are the names and cities of bank branches that offer loans for business? | Tables: 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. | Joins: custo...
what are the names and cities of bank branches that offer loans for business?
loan_1
select t2.bname from loan as t1 join bank as t2 on t1.branch_id = t2.branch_id join customer as t3 on t1.cust_id = t3.cust_id where t3.credit_score < 100
Question: find the names of bank branches that have provided a loan to any customer whose credit score is below 100. | Tables: 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, bran...
find the names of bank branches that have provided a loan to any customer whose credit score is below 100.
loan_1
select t2.bname from loan as t1 join bank as t2 on t1.branch_id = t2.branch_id join customer as t3 on t1.cust_id = t3.cust_id where t3.credit_score < 100
Question: what are the names of banks that have loaned money to customers with credit scores below 100? | Tables: 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...
what are the names of banks that have loaned money to customers with credit scores below 100?
loan_1
select sum(t2.amount) from bank as t1 join loan as t2 on t1.branch_id = t2.branch_id where t1.state = 'new york'
Question: find the total amount of loans provided by bank branches in the state of new york. | Tables: 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. | Joins: ...
find the total amount of loans provided by bank branches in the state of new york.
loan_1
select sum(t2.amount) from bank as t1 join loan as t2 on t1.branch_id = t2.branch_id where t1.state = 'new york'
Question: what is the total amount of money loaned by banks in new york state? | Tables: 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. | Joins: customer.branc...
what is the total amount of money loaned by banks in new york state?
loan_1
select avg(credit_score) from customer where cust_id in (select cust_id from loan)
Question: find the average credit score of the customers who have some loan. | Tables: 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. | Joins: customer.branch_...
find the average credit score of the customers who have some loan.
loan_1
select avg(credit_score) from customer where cust_id in (select cust_id from loan)
Question: what is the average credit score for customers who have taken a loan? | Tables: 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. | Joins: customer.bran...
what is the average credit score for customers who have taken a loan?
loan_1
select avg(credit_score) from customer where cust_id not in (select cust_id from loan)
Question: find the average credit score of the customers who do not have any loan. | Tables: 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. | Joins: customer.b...
find the average credit score of the customers who do not have any loan.
loan_1
select avg(credit_score) from customer where cust_id not in (select cust_id from loan)
Question: what is the average credit score for customers who have never taken a loan? | Tables: 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. | Joins: custome...
what is the average credit score for customers who have never taken a loan?
behavior_monitoring
select count(*) from assessment_notes
Question: how many assessment notes are there in total? | Tables: Ref_Address_Types -> address_type_code, address_type_description. Ref_Detention_Type -> detention_type_code, detention_type_description. Ref_Incident_Type -> incident_type_code, incident_type_description. Addresses -> address_id, line_1, line_2, line_3, ...
how many assessment notes are there in total?
behavior_monitoring
select date_of_notes from assessment_notes
Question: what are the dates of the assessment notes? | Tables: Ref_Address_Types -> address_type_code, address_type_description. Ref_Detention_Type -> detention_type_code, detention_type_description. Ref_Incident_Type -> incident_type_code, incident_type_description. Addresses -> address_id, line_1, line_2, line_3, ci...
what are the dates of the assessment notes?
behavior_monitoring
select count(*) from addresses where zip_postcode = '197'
Question: how many addresses have zip code 197? | Tables: Ref_Address_Types -> address_type_code, address_type_description. Ref_Detention_Type -> detention_type_code, detention_type_description. Ref_Incident_Type -> incident_type_code, incident_type_description. Addresses -> address_id, line_1, line_2, line_3, city, zi...
how many addresses have zip code 197?
behavior_monitoring
select count(distinct incident_type_code) from behavior_incident
Question: how many distinct incident type codes are there? | Tables: Ref_Address_Types -> address_type_code, address_type_description. Ref_Detention_Type -> detention_type_code, detention_type_description. Ref_Incident_Type -> incident_type_code, incident_type_description. Addresses -> address_id, line_1, line_2, line_...
how many distinct incident type codes are there?
behavior_monitoring
select distinct detention_type_code from detention
Question: return all distinct detention type codes. | Tables: Ref_Address_Types -> address_type_code, address_type_description. Ref_Detention_Type -> detention_type_code, detention_type_description. Ref_Incident_Type -> incident_type_code, incident_type_description. Addresses -> address_id, line_1, line_2, line_3, city...
return all distinct detention type codes.
behavior_monitoring
select date_incident_start , date_incident_end from behavior_incident where incident_type_code = 'noise'
Question: what are the start and end dates for incidents with incident type code 'noise'? | Tables: Ref_Address_Types -> address_type_code, address_type_description. Ref_Detention_Type -> detention_type_code, detention_type_description. Ref_Incident_Type -> incident_type_code, incident_type_description. Addresses -> ad...
what are the start and end dates for incidents with incident type code 'noise'?
behavior_monitoring
select detention_summary from detention
Question: return all detention summaries. | Tables: Ref_Address_Types -> address_type_code, address_type_description. Ref_Detention_Type -> detention_type_code, detention_type_description. Ref_Incident_Type -> incident_type_code, incident_type_description. Addresses -> address_id, line_1, line_2, line_3, city, zip_post...
return all detention summaries.
behavior_monitoring
select cell_mobile_number , email_address from students
Question: return the cell phone number and email address for all students. | Tables: Ref_Address_Types -> address_type_code, address_type_description. Ref_Detention_Type -> detention_type_code, detention_type_description. Ref_Incident_Type -> incident_type_code, incident_type_description. Addresses -> address_id, line_...
return the cell phone number and email address for all students.
behavior_monitoring
select email_address from students where first_name = 'emma' and last_name = 'rohan'
Question: what is the email of the student with first name 'emma' and last name 'rohan'? | Tables: Ref_Address_Types -> address_type_code, address_type_description. Ref_Detention_Type -> detention_type_code, detention_type_description. Ref_Incident_Type -> incident_type_code, incident_type_description. Addresses -> add...
what is the email of the student with first name 'emma' and last name 'rohan'?
behavior_monitoring
select count(distinct student_id) from students_in_detention
Question: how many distinct students have been in detention? | Tables: Ref_Address_Types -> address_type_code, address_type_description. Ref_Detention_Type -> detention_type_code, detention_type_description. Ref_Incident_Type -> incident_type_code, incident_type_description. Addresses -> address_id, line_1, line_2, lin...
how many distinct students have been in detention?
behavior_monitoring
select gender from teachers where last_name = 'medhurst'
Question: what is the gender of the teacher with last name 'medhurst'? | Tables: Ref_Address_Types -> address_type_code, address_type_description. Ref_Detention_Type -> detention_type_code, detention_type_description. Ref_Incident_Type -> incident_type_code, incident_type_description. Addresses -> address_id, line_1, l...
what is the gender of the teacher with last name 'medhurst'?
behavior_monitoring
select incident_type_description from ref_incident_type where incident_type_code = 'violence'
Question: what is the incident type description for the incident type with code 'violence'? | Tables: Ref_Address_Types -> address_type_code, address_type_description. Ref_Detention_Type -> detention_type_code, detention_type_description. Ref_Incident_Type -> incident_type_code, incident_type_description. Addresses -> ...
what is the incident type description for the incident type with code 'violence'?
behavior_monitoring
select max(monthly_rental) , min(monthly_rental) from student_addresses
Question: find the maximum and minimum monthly rental for all student addresses. | Tables: Ref_Address_Types -> address_type_code, address_type_description. Ref_Detention_Type -> detention_type_code, detention_type_description. Ref_Incident_Type -> incident_type_code, incident_type_description. Addresses -> address_id,...
find the maximum and minimum monthly rental for all student addresses.
behavior_monitoring
select first_name from teachers where email_address like '%man%'
Question: find the first names of teachers whose email address contains the word 'man'. | Tables: Ref_Address_Types -> address_type_code, address_type_description. Ref_Detention_Type -> detention_type_code, detention_type_description. Ref_Incident_Type -> incident_type_code, incident_type_description. Addresses -> addr...
find the first names of teachers whose email address contains the word 'man'.