input
stringlengths
191
7.13k
output
stringlengths
19
578
Tables: actor, address, category, city, country, customer, film, film_actor, film_category, film_text, inventory, language, payment, rental, staff, store Columns: actor.actor_id, actor.first_name, actor.last_name, actor.last_update, address.address_id, address.address, address.address2, address.district, address.city_i...
SELECT amount FROM payment ORDER BY amount DESC LIMIT 1;
Tables: actor, address, category, city, country, customer, film, film_actor, film_category, film_text, inventory, language, payment, rental, staff, store Columns: actor.actor_id, actor.first_name, actor.last_name, actor.last_update, address.address_id, address.address, address.address2, address.district, address.city_i...
SELECT amount FROM payment ORDER BY amount DESC LIMIT 1;
Tables: actor, address, category, city, country, customer, film, film_actor, film_category, film_text, inventory, language, payment, rental, staff, store Columns: actor.actor_id, actor.first_name, actor.last_name, actor.last_update, address.address_id, address.address, address.address2, address.district, address.city_i...
SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Elsa';
Tables: actor, address, category, city, country, customer, film, film_actor, film_category, film_text, inventory, language, payment, rental, staff, store Columns: actor.actor_id, actor.first_name, actor.last_name, actor.last_update, address.address_id, address.address, address.address2, address.district, address.city_i...
SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Elsa';
Tables: actor, address, category, city, country, customer, film, film_actor, film_category, film_text, inventory, language, payment, rental, staff, store Columns: actor.actor_id, actor.first_name, actor.last_name, actor.last_update, address.address_id, address.address, address.address2, address.district, address.city_i...
SELECT first_name FROM customer WHERE customer_id NOT IN( SELECT customer_id FROM rental WHERE rental_date > '2005-08-23 02:06:01' );
Tables: actor, address, category, city, country, customer, film, film_actor, film_category, film_text, inventory, language, payment, rental, staff, store Columns: actor.actor_id, actor.first_name, actor.last_name, actor.last_update, address.address_id, address.address, address.address2, address.district, address.city_i...
SELECT first_name FROM customer WHERE customer_id NOT IN( SELECT customer_id FROM rental WHERE rental_date > '2005-08-23 02:06:01' );
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT count(*) FROM bank;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT count(*) FROM bank;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT sum(no_of_customers) FROM bank;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT sum(no_of_customers) FROM bank;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT sum(no_of_customers) FROM bank WHERE city = 'New York City';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT sum(no_of_customers) FROM bank WHERE city = 'New York City';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT avg(no_of_customers) FROM bank WHERE state = 'Utah';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT avg(no_of_customers) FROM bank WHERE state = 'Utah';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT avg(no_of_customers) FROM bank;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT avg(no_of_customers) FROM bank;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT city , state FROM bank WHERE bname = 'morningside';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT city , state FROM bank WHERE bname = 'morningside';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT bname FROM bank WHERE state = 'New York';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT bname FROM bank WHERE state = 'New York';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT cust_name FROM customer ORDER BY acc_bal;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT cust_name FROM customer ORDER BY acc_bal;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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);
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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);
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT state , acc_type , credit_score FROM customer WHERE no_of_loans = 0;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT state , acc_type , credit_score FROM customer WHERE no_of_loans = 0;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT count(DISTINCT city) FROM bank;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT count(DISTINCT city) FROM bank;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT count(DISTINCT state) FROM bank;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT count(DISTINCT state) FROM bank;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT count(DISTINCT acc_type) FROM customer;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT count(DISTINCT acc_type) FROM customer;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT cust_name , acc_bal FROM customer WHERE cust_name LIKE '%a%';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT cust_name , acc_bal FROM customer WHERE cust_name LIKE '%a%';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT sum(acc_bal) FROM customer WHERE state = 'Utah' OR state = 'Texas';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT sum(acc_bal) FROM customer WHERE state = 'Utah' OR state = 'Texas';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT cust_name FROM customer WHERE acc_type = 'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type = 'checking';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT cust_name FROM customer WHERE acc_type = 'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type = 'checking';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT cust_name FROM customer WHERE credit_score < (SELECT avg(credit_score) FROM customer);
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT cust_name FROM customer WHERE credit_score < (SELECT avg(credit_score) FROM customer);
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT bname FROM bank ORDER BY no_of_customers DESC LIMIT 1;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT bname FROM bank ORDER BY no_of_customers DESC LIMIT 1;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT cust_name FROM customer ORDER BY credit_score LIMIT 1;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT cust_name FROM customer ORDER BY credit_score LIMIT 1;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT cust_name , acc_type , acc_bal FROM customer ORDER BY credit_score DESC LIMIT 1;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT cust_name , acc_type , acc_bal FROM customer ORDER BY credit_score DESC LIMIT 1;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT state FROM bank GROUP BY state ORDER BY sum(no_of_customers) DESC LIMIT 1;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT state FROM bank GROUP BY state ORDER BY sum(no_of_customers) DESC LIMIT 1;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT avg(acc_bal) , acc_type FROM customer WHERE credit_score < 50 GROUP BY acc_type;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT avg(acc_bal) , acc_type FROM customer WHERE credit_score < 50 GROUP BY acc_type;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT sum(acc_bal) , state FROM customer WHERE credit_score > 100 GROUP BY state;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT sum(acc_bal) , state FROM customer WHERE credit_score > 100 GROUP BY state;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT sum(amount) , T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT sum(amount) , T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT DISTINCT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT DISTINCT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT DISTINCT T1.cust_name , T1.credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT DISTINCT T1.cust_name , T1.credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE amount > 3000;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE amount > 3000;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
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;
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT sum(T2.amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id WHERE T1.state = 'New York';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT sum(T2.amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id WHERE T1.state = 'New York';
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT avg(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan);
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT avg(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan);
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT avg(credit_score) FROM customer WHERE cust_id NOT IN (SELECT cust_id FROM loan);
Tables: bank, customer, loan Columns: bank.branch_ID, bank.bname, bank.no_of_customers, bank.city, bank.state, customer.cust_ID, customer.cust_name, customer.acc_type, customer.acc_bal, customer.no_of_loans, customer.credit_score, customer.branch_ID, customer.state, loan.loan_ID, loan.loan_type, loan.cust_ID, loan.bran...
SELECT avg(credit_score) FROM customer WHERE cust_id NOT IN (SELECT cust_id FROM loan);
Tables: Ref_Address_Types, Ref_Detention_Type, Ref_Incident_Type, Addresses, Students, Teachers, Assessment_Notes, Behavior_Incident, Detention, Student_Addresses, Students_in_Detention Columns: Ref_Address_Types.address_type_code, Ref_Address_Types.address_type_description, Ref_Detention_Type.detention_type_code, Ref_...
SELECT count(*) FROM ASSESSMENT_NOTES;
Tables: Ref_Address_Types, Ref_Detention_Type, Ref_Incident_Type, Addresses, Students, Teachers, Assessment_Notes, Behavior_Incident, Detention, Student_Addresses, Students_in_Detention Columns: Ref_Address_Types.address_type_code, Ref_Address_Types.address_type_description, Ref_Detention_Type.detention_type_code, Ref_...
SELECT date_of_notes FROM Assessment_Notes;
Tables: Ref_Address_Types, Ref_Detention_Type, Ref_Incident_Type, Addresses, Students, Teachers, Assessment_Notes, Behavior_Incident, Detention, Student_Addresses, Students_in_Detention Columns: Ref_Address_Types.address_type_code, Ref_Address_Types.address_type_description, Ref_Detention_Type.detention_type_code, Ref_...
SELECT count(*) FROM ADDRESSES WHERE zip_postcode = "197";
Tables: Ref_Address_Types, Ref_Detention_Type, Ref_Incident_Type, Addresses, Students, Teachers, Assessment_Notes, Behavior_Incident, Detention, Student_Addresses, Students_in_Detention Columns: Ref_Address_Types.address_type_code, Ref_Address_Types.address_type_description, Ref_Detention_Type.detention_type_code, Ref_...
SELECT count(DISTINCT incident_type_code) FROM Behavior_Incident;
Tables: Ref_Address_Types, Ref_Detention_Type, Ref_Incident_Type, Addresses, Students, Teachers, Assessment_Notes, Behavior_Incident, Detention, Student_Addresses, Students_in_Detention Columns: Ref_Address_Types.address_type_code, Ref_Address_Types.address_type_description, Ref_Detention_Type.detention_type_code, Ref_...
SELECT DISTINCT detention_type_code FROM Detention;
Tables: Ref_Address_Types, Ref_Detention_Type, Ref_Incident_Type, Addresses, Students, Teachers, Assessment_Notes, Behavior_Incident, Detention, Student_Addresses, Students_in_Detention Columns: Ref_Address_Types.address_type_code, Ref_Address_Types.address_type_description, Ref_Detention_Type.detention_type_code, Ref_...
SELECT date_incident_start , date_incident_end FROM Behavior_Incident WHERE incident_type_code = "NOISE";
Tables: Ref_Address_Types, Ref_Detention_Type, Ref_Incident_Type, Addresses, Students, Teachers, Assessment_Notes, Behavior_Incident, Detention, Student_Addresses, Students_in_Detention Columns: Ref_Address_Types.address_type_code, Ref_Address_Types.address_type_description, Ref_Detention_Type.detention_type_code, Ref_...
SELECT detention_summary FROM Detention;
Tables: Ref_Address_Types, Ref_Detention_Type, Ref_Incident_Type, Addresses, Students, Teachers, Assessment_Notes, Behavior_Incident, Detention, Student_Addresses, Students_in_Detention Columns: Ref_Address_Types.address_type_code, Ref_Address_Types.address_type_description, Ref_Detention_Type.detention_type_code, Ref_...
SELECT cell_mobile_number , email_address FROM STUDENTS;
Tables: Ref_Address_Types, Ref_Detention_Type, Ref_Incident_Type, Addresses, Students, Teachers, Assessment_Notes, Behavior_Incident, Detention, Student_Addresses, Students_in_Detention Columns: Ref_Address_Types.address_type_code, Ref_Address_Types.address_type_description, Ref_Detention_Type.detention_type_code, Ref_...
SELECT email_address FROM Students WHERE first_name = "Emma" AND last_name = "Rohan";
Tables: Ref_Address_Types, Ref_Detention_Type, Ref_Incident_Type, Addresses, Students, Teachers, Assessment_Notes, Behavior_Incident, Detention, Student_Addresses, Students_in_Detention Columns: Ref_Address_Types.address_type_code, Ref_Address_Types.address_type_description, Ref_Detention_Type.detention_type_code, Ref_...
SELECT count(DISTINCT student_id) FROM Students_in_Detention;
Tables: Ref_Address_Types, Ref_Detention_Type, Ref_Incident_Type, Addresses, Students, Teachers, Assessment_Notes, Behavior_Incident, Detention, Student_Addresses, Students_in_Detention Columns: Ref_Address_Types.address_type_code, Ref_Address_Types.address_type_description, Ref_Detention_Type.detention_type_code, Ref_...
SELECT gender FROM TEACHERS WHERE last_name = "Medhurst";
Tables: Ref_Address_Types, Ref_Detention_Type, Ref_Incident_Type, Addresses, Students, Teachers, Assessment_Notes, Behavior_Incident, Detention, Student_Addresses, Students_in_Detention Columns: Ref_Address_Types.address_type_code, Ref_Address_Types.address_type_description, Ref_Detention_Type.detention_type_code, Ref_...
SELECT incident_type_description FROM Ref_Incident_Type WHERE incident_type_code = "VIOLENCE";
Tables: Ref_Address_Types, Ref_Detention_Type, Ref_Incident_Type, Addresses, Students, Teachers, Assessment_Notes, Behavior_Incident, Detention, Student_Addresses, Students_in_Detention Columns: Ref_Address_Types.address_type_code, Ref_Address_Types.address_type_description, Ref_Detention_Type.detention_type_code, Ref_...
SELECT max(monthly_rental) , min(monthly_rental) FROM Student_Addresses;
Tables: Ref_Address_Types, Ref_Detention_Type, Ref_Incident_Type, Addresses, Students, Teachers, Assessment_Notes, Behavior_Incident, Detention, Student_Addresses, Students_in_Detention Columns: Ref_Address_Types.address_type_code, Ref_Address_Types.address_type_description, Ref_Detention_Type.detention_type_code, Ref_...
SELECT first_name FROM Teachers WHERE email_address LIKE '%man%';