db_name
stringclasses
146 values
prompt
stringlengths
310
4.81k
sakila_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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, country, last_update ) # customer ( customer_id, store_id, first_name, last_name, email, address_id, active, create_date, last_update ) # film ( film_id, title, description, release_year, language_id, original_language_id, rental_duration, rental_rate, length, replacement_cost, rating, special_features, last_update ) # film_actor ( actor_id, film_id, last_update ) # film_category ( film_id, category_id, last_update ) # film_text ( film_id, title, description ) # inventory ( inventory_id, film_id, store_id, last_update ) # language ( language_id, name, last_update ) # payment ( payment_id, customer_id, staff_id, rental_id, amount, payment_date, last_update ) # rental ( rental_id, rental_date, inventory_id, customer_id, return_date, staff_id, last_update ) # staff ( staff_id, first_name, last_name, address_id, picture, email, store_id, active, username, password, last_update ) # store ( store_id, manager_staff_id, address_id, last_update ) # # address.city_id can be joined with city.city_id # city.country_id can be joined with country.country_id # customer.store_id can be joined with store.store_id # customer.address_id can be joined with address.address_id # film.original_language_id can be joined with language.language_id # film.language_id can be joined with language.language_id # film_actor.film_id can be joined with film.film_id # film_actor.actor_id can be joined with actor.actor_id # film_category.category_id can be joined with category.category_id # film_category.film_id can be joined with film.film_id # inventory.film_id can be joined with film.film_id # inventory.store_id can be joined with store.store_id # payment.staff_id can be joined with staff.staff_id # payment.customer_id can be joined with customer.customer_id # payment.rental_id can be joined with rental.rental_id # rental.customer_id can be joined with customer.customer_id # rental.inventory_id can be joined with inventory.inventory_id # rental.staff_id can be joined with staff.staff_id # staff.address_id can be joined with address.address_id # store.address_id can be joined with address.address_id # store.manager_staff_id can be joined with staff.staff_id # ### Question: # # What is the largest payment amount? # ### SQL: # # SELECT amount FROM payment ORDER BY amount DESC LIMIT 1 # ### End.
sakila_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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, country, last_update ) # customer ( customer_id, store_id, first_name, last_name, email, address_id, active, create_date, last_update ) # film ( film_id, title, description, release_year, language_id, original_language_id, rental_duration, rental_rate, length, replacement_cost, rating, special_features, last_update ) # film_actor ( actor_id, film_id, last_update ) # film_category ( film_id, category_id, last_update ) # film_text ( film_id, title, description ) # inventory ( inventory_id, film_id, store_id, last_update ) # language ( language_id, name, last_update ) # payment ( payment_id, customer_id, staff_id, rental_id, amount, payment_date, last_update ) # rental ( rental_id, rental_date, inventory_id, customer_id, return_date, staff_id, last_update ) # staff ( staff_id, first_name, last_name, address_id, picture, email, store_id, active, username, password, last_update ) # store ( store_id, manager_staff_id, address_id, last_update ) # # address.city_id can be joined with city.city_id # city.country_id can be joined with country.country_id # customer.store_id can be joined with store.store_id # customer.address_id can be joined with address.address_id # film.original_language_id can be joined with language.language_id # film.language_id can be joined with language.language_id # film_actor.film_id can be joined with film.film_id # film_actor.actor_id can be joined with actor.actor_id # film_category.category_id can be joined with category.category_id # film_category.film_id can be joined with film.film_id # inventory.film_id can be joined with film.film_id # inventory.store_id can be joined with store.store_id # payment.staff_id can be joined with staff.staff_id # payment.customer_id can be joined with customer.customer_id # payment.rental_id can be joined with rental.rental_id # rental.customer_id can be joined with customer.customer_id # rental.inventory_id can be joined with inventory.inventory_id # rental.staff_id can be joined with staff.staff_id # staff.address_id can be joined with address.address_id # store.address_id can be joined with address.address_id # store.manager_staff_id can be joined with staff.staff_id # ### Question: # # Return the amount of the largest payment. # ### SQL: # # SELECT amount FROM payment ORDER BY amount DESC LIMIT 1 # ### End.
sakila_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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, country, last_update ) # customer ( customer_id, store_id, first_name, last_name, email, address_id, active, create_date, last_update ) # film ( film_id, title, description, release_year, language_id, original_language_id, rental_duration, rental_rate, length, replacement_cost, rating, special_features, last_update ) # film_actor ( actor_id, film_id, last_update ) # film_category ( film_id, category_id, last_update ) # film_text ( film_id, title, description ) # inventory ( inventory_id, film_id, store_id, last_update ) # language ( language_id, name, last_update ) # payment ( payment_id, customer_id, staff_id, rental_id, amount, payment_date, last_update ) # rental ( rental_id, rental_date, inventory_id, customer_id, return_date, staff_id, last_update ) # staff ( staff_id, first_name, last_name, address_id, picture, email, store_id, active, username, password, last_update ) # store ( store_id, manager_staff_id, address_id, last_update ) # # address.city_id can be joined with city.city_id # city.country_id can be joined with country.country_id # customer.store_id can be joined with store.store_id # customer.address_id can be joined with address.address_id # film.original_language_id can be joined with language.language_id # film.language_id can be joined with language.language_id # film_actor.film_id can be joined with film.film_id # film_actor.actor_id can be joined with actor.actor_id # film_category.category_id can be joined with category.category_id # film_category.film_id can be joined with film.film_id # inventory.film_id can be joined with film.film_id # inventory.store_id can be joined with store.store_id # payment.staff_id can be joined with staff.staff_id # payment.customer_id can be joined with customer.customer_id # payment.rental_id can be joined with rental.rental_id # rental.customer_id can be joined with customer.customer_id # rental.inventory_id can be joined with inventory.inventory_id # rental.staff_id can be joined with staff.staff_id # staff.address_id can be joined with address.address_id # store.address_id can be joined with address.address_id # store.manager_staff_id can be joined with staff.staff_id # ### Question: # # Where does the staff member with the first name Elsa live? # ### SQL: # # SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Elsa' # ### End.
sakila_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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, country, last_update ) # customer ( customer_id, store_id, first_name, last_name, email, address_id, active, create_date, last_update ) # film ( film_id, title, description, release_year, language_id, original_language_id, rental_duration, rental_rate, length, replacement_cost, rating, special_features, last_update ) # film_actor ( actor_id, film_id, last_update ) # film_category ( film_id, category_id, last_update ) # film_text ( film_id, title, description ) # inventory ( inventory_id, film_id, store_id, last_update ) # language ( language_id, name, last_update ) # payment ( payment_id, customer_id, staff_id, rental_id, amount, payment_date, last_update ) # rental ( rental_id, rental_date, inventory_id, customer_id, return_date, staff_id, last_update ) # staff ( staff_id, first_name, last_name, address_id, picture, email, store_id, active, username, password, last_update ) # store ( store_id, manager_staff_id, address_id, last_update ) # # address.city_id can be joined with city.city_id # city.country_id can be joined with country.country_id # customer.store_id can be joined with store.store_id # customer.address_id can be joined with address.address_id # film.original_language_id can be joined with language.language_id # film.language_id can be joined with language.language_id # film_actor.film_id can be joined with film.film_id # film_actor.actor_id can be joined with actor.actor_id # film_category.category_id can be joined with category.category_id # film_category.film_id can be joined with film.film_id # inventory.film_id can be joined with film.film_id # inventory.store_id can be joined with store.store_id # payment.staff_id can be joined with staff.staff_id # payment.customer_id can be joined with customer.customer_id # payment.rental_id can be joined with rental.rental_id # rental.customer_id can be joined with customer.customer_id # rental.inventory_id can be joined with inventory.inventory_id # rental.staff_id can be joined with staff.staff_id # staff.address_id can be joined with address.address_id # store.address_id can be joined with address.address_id # store.manager_staff_id can be joined with staff.staff_id # ### Question: # # Give the address of the staff member who has the first name Elsa. # ### SQL: # # SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Elsa' # ### End.
sakila_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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, country, last_update ) # customer ( customer_id, store_id, first_name, last_name, email, address_id, active, create_date, last_update ) # film ( film_id, title, description, release_year, language_id, original_language_id, rental_duration, rental_rate, length, replacement_cost, rating, special_features, last_update ) # film_actor ( actor_id, film_id, last_update ) # film_category ( film_id, category_id, last_update ) # film_text ( film_id, title, description ) # inventory ( inventory_id, film_id, store_id, last_update ) # language ( language_id, name, last_update ) # payment ( payment_id, customer_id, staff_id, rental_id, amount, payment_date, last_update ) # rental ( rental_id, rental_date, inventory_id, customer_id, return_date, staff_id, last_update ) # staff ( staff_id, first_name, last_name, address_id, picture, email, store_id, active, username, password, last_update ) # store ( store_id, manager_staff_id, address_id, last_update ) # # address.city_id can be joined with city.city_id # city.country_id can be joined with country.country_id # customer.store_id can be joined with store.store_id # customer.address_id can be joined with address.address_id # film.original_language_id can be joined with language.language_id # film.language_id can be joined with language.language_id # film_actor.film_id can be joined with film.film_id # film_actor.actor_id can be joined with actor.actor_id # film_category.category_id can be joined with category.category_id # film_category.film_id can be joined with film.film_id # inventory.film_id can be joined with film.film_id # inventory.store_id can be joined with store.store_id # payment.staff_id can be joined with staff.staff_id # payment.customer_id can be joined with customer.customer_id # payment.rental_id can be joined with rental.rental_id # rental.customer_id can be joined with customer.customer_id # rental.inventory_id can be joined with inventory.inventory_id # rental.staff_id can be joined with staff.staff_id # staff.address_id can be joined with address.address_id # store.address_id can be joined with address.address_id # store.manager_staff_id can be joined with staff.staff_id # ### Question: # # What are the first names of customers who have not rented any films after '2005-08-23 02:06:01'? # ### SQL: # # SELECT first_name FROM customer WHERE customer_id NOT IN( SELECT customer_id FROM rental WHERE rental_date > '2005-08-23 02:06:01' ) # ### End.
sakila_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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, country, last_update ) # customer ( customer_id, store_id, first_name, last_name, email, address_id, active, create_date, last_update ) # film ( film_id, title, description, release_year, language_id, original_language_id, rental_duration, rental_rate, length, replacement_cost, rating, special_features, last_update ) # film_actor ( actor_id, film_id, last_update ) # film_category ( film_id, category_id, last_update ) # film_text ( film_id, title, description ) # inventory ( inventory_id, film_id, store_id, last_update ) # language ( language_id, name, last_update ) # payment ( payment_id, customer_id, staff_id, rental_id, amount, payment_date, last_update ) # rental ( rental_id, rental_date, inventory_id, customer_id, return_date, staff_id, last_update ) # staff ( staff_id, first_name, last_name, address_id, picture, email, store_id, active, username, password, last_update ) # store ( store_id, manager_staff_id, address_id, last_update ) # # address.city_id can be joined with city.city_id # city.country_id can be joined with country.country_id # customer.store_id can be joined with store.store_id # customer.address_id can be joined with address.address_id # film.original_language_id can be joined with language.language_id # film.language_id can be joined with language.language_id # film_actor.film_id can be joined with film.film_id # film_actor.actor_id can be joined with actor.actor_id # film_category.category_id can be joined with category.category_id # film_category.film_id can be joined with film.film_id # inventory.film_id can be joined with film.film_id # inventory.store_id can be joined with store.store_id # payment.staff_id can be joined with staff.staff_id # payment.customer_id can be joined with customer.customer_id # payment.rental_id can be joined with rental.rental_id # rental.customer_id can be joined with customer.customer_id # rental.inventory_id can be joined with inventory.inventory_id # rental.staff_id can be joined with staff.staff_id # staff.address_id can be joined with address.address_id # store.address_id can be joined with address.address_id # store.manager_staff_id can be joined with staff.staff_id # ### Question: # # Return the first names of customers who did not rented a film after the date '2005-08-23 02:06:01'. # ### SQL: # # SELECT first_name FROM customer WHERE customer_id NOT IN( SELECT customer_id FROM rental WHERE rental_date > '2005-08-23 02:06:01' ) # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # How many bank branches are there? # ### SQL: # # SELECT count(*) FROM bank # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Count the number of bank branches. # ### SQL: # # SELECT count(*) FROM bank # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # How many customers are there? # ### SQL: # # SELECT sum(no_of_customers) FROM bank # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What is the total number of customers across banks? # ### SQL: # # SELECT sum(no_of_customers) FROM bank # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the number of customers in the banks at New York City. # ### SQL: # # SELECT sum(no_of_customers) FROM bank WHERE city = 'New York City' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What is the total number of customers who use banks in New York City? # ### SQL: # # SELECT sum(no_of_customers) FROM bank WHERE city = 'New York City' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the average number of customers in all banks of Utah state. # ### SQL: # # SELECT avg(no_of_customers) FROM bank WHERE state = 'Utah' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What is the average number of customers across banks in the state of Utah? # ### SQL: # # SELECT avg(no_of_customers) FROM bank WHERE state = 'Utah' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the average number of customers cross all banks. # ### SQL: # # SELECT avg(no_of_customers) FROM bank # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What is the average number of bank customers? # ### SQL: # # SELECT avg(no_of_customers) FROM bank # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the city and state of the bank branch named morningside. # ### SQL: # # SELECT city , state FROM bank WHERE bname = 'morningside' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What city and state is the bank with the name morningside in? # ### SQL: # # SELECT city , state FROM bank WHERE bname = 'morningside' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the branch names of banks in the New York state. # ### SQL: # # SELECT bname FROM bank WHERE state = 'New York' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the names of banks in the state of New York? # ### SQL: # # SELECT bname FROM bank WHERE state = 'New York' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # List the name of all customers sorted by their account balance in ascending order. # ### SQL: # # SELECT cust_name FROM customer ORDER BY acc_bal # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the names of all customers, ordered by account balance? # ### SQL: # # SELECT cust_name FROM customer ORDER BY acc_bal # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # List the name of all different customers who have some loan sorted by their total loan amount. # ### SQL: # # 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) # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the names of the different customers who have taken out a loan, ordered by the total amount that they have taken? # ### SQL: # # 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) # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the state, account type, and credit score of the customer whose number of loan is 0. # ### SQL: # # SELECT state , acc_type , credit_score FROM customer WHERE no_of_loans = 0 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the states, account types, and credit scores for customers who have 0 loans? # ### SQL: # # SELECT state , acc_type , credit_score FROM customer WHERE no_of_loans = 0 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the number of different cities which banks are located at. # ### SQL: # # SELECT count(DISTINCT city) FROM bank # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # In how many different cities are banks located? # ### SQL: # # SELECT count(DISTINCT city) FROM bank # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the number of different states which banks are located at. # ### SQL: # # SELECT count(DISTINCT state) FROM bank # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # In how many different states are banks located? # ### SQL: # # SELECT count(DISTINCT state) FROM bank # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # How many distinct types of accounts are there? # ### SQL: # # SELECT count(DISTINCT acc_type) FROM customer # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Count the number of different account types. # ### SQL: # # SELECT count(DISTINCT acc_type) FROM customer # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the name and account balance of the customer whose name includes the letter ‘a’. # ### SQL: # # SELECT cust_name , acc_bal FROM customer WHERE cust_name LIKE '%a%' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the names and account balances of customers with the letter a in their names? # ### SQL: # # SELECT cust_name , acc_bal FROM customer WHERE cust_name LIKE '%a%' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the total account balance of each customer from Utah or Texas. # ### SQL: # # SELECT sum(acc_bal) FROM customer WHERE state = 'Utah' OR state = 'Texas' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the total account balances for each customer from Utah or Texas? # ### SQL: # # SELECT sum(acc_bal) FROM customer WHERE state = 'Utah' OR state = 'Texas' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the name of customers who have both saving and checking account types. # ### SQL: # # SELECT cust_name FROM customer WHERE acc_type = 'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type = 'checking' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the names of customers who have both savings and checking accounts? # ### SQL: # # SELECT cust_name FROM customer WHERE acc_type = 'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type = 'checking' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the name of customers who do not have an saving account. # ### SQL: # # SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the names of customers who do not have saving accounts? # ### SQL: # # SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the name of customers who do not have a loan with a type of Mortgages. # ### SQL: # # 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' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the names of customers who have not taken a Mortage loan? # ### SQL: # # 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' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the name of customers who have loans of both Mortgages and Auto. # ### SQL: # # 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' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the names of customers who have taken both Mortgage and Auto loans? # ### SQL: # # 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' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the name of customers whose credit score is below the average credit scores of all customers. # ### SQL: # # SELECT cust_name FROM customer WHERE credit_score < (SELECT avg(credit_score) FROM customer) # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the names of customers with credit score less than the average credit score across customers? # ### SQL: # # SELECT cust_name FROM customer WHERE credit_score < (SELECT avg(credit_score) FROM customer) # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the branch name of the bank that has the most number of customers. # ### SQL: # # SELECT bname FROM bank ORDER BY no_of_customers DESC LIMIT 1 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What is the name of the bank branch with the greatest number of customers? # ### SQL: # # SELECT bname FROM bank ORDER BY no_of_customers DESC LIMIT 1 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the name of customer who has the lowest credit score. # ### SQL: # # SELECT cust_name FROM customer ORDER BY credit_score LIMIT 1 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What is the name of the customer with the worst credit score? # ### SQL: # # SELECT cust_name FROM customer ORDER BY credit_score LIMIT 1 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the name, account type, and account balance of the customer who has the highest credit score. # ### SQL: # # SELECT cust_name , acc_type , acc_bal FROM customer ORDER BY credit_score DESC LIMIT 1 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What is the name, account type, and account balance corresponding to the customer with the highest credit score? # ### SQL: # # SELECT cust_name , acc_type , acc_bal FROM customer ORDER BY credit_score DESC LIMIT 1 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the name of customer who has the highest amount of loans. # ### SQL: # # 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 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What is the name of the customer who has greatest total loan amount? # ### SQL: # # 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 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the state which has the most number of customers. # ### SQL: # # SELECT state FROM bank GROUP BY state ORDER BY sum(no_of_customers) DESC LIMIT 1 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Which state has the greatest total number of bank customers? # ### SQL: # # SELECT state FROM bank GROUP BY state ORDER BY sum(no_of_customers) DESC LIMIT 1 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # For each account type, find the average account balance of customers with credit score lower than 50. # ### SQL: # # SELECT avg(acc_bal) , acc_type FROM customer WHERE credit_score < 50 GROUP BY acc_type # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What is the average account balance of customers with credit score below 50 for the different account types? # ### SQL: # # SELECT avg(acc_bal) , acc_type FROM customer WHERE credit_score < 50 GROUP BY acc_type # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # For each state, find the total account balance of customers whose credit score is above 100. # ### SQL: # # SELECT sum(acc_bal) , state FROM customer WHERE credit_score > 100 GROUP BY state # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What is the total account balance for customers with a credit score of above 100 for the different states? # ### SQL: # # SELECT sum(acc_bal) , state FROM customer WHERE credit_score > 100 GROUP BY state # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the total amount of loans offered by each bank branch. # ### SQL: # # SELECT sum(amount) , T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the names of the different bank branches, and what are their total loan amounts? # ### SQL: # # SELECT sum(amount) , T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the name of customers who have more than one loan. # ### SQL: # # 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 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the names of customers who have taken out more than one loan? # ### SQL: # # 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 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the name and account balance of the customers who have loans with a total amount of more than 5000. # ### SQL: # # 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 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the names and account balances for customers who have taken a total amount of more than 5000 in loans? # ### SQL: # # 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 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the name of bank branch that provided the greatest total amount of loans. # ### SQL: # # 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 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What is the name of the bank branch that has lent the greatest amount? # ### SQL: # # 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 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the name of bank branch that provided the greatest total amount of loans to customers with credit score is less than 100. # ### SQL: # # 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 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### 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? # ### SQL: # # 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 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the name of bank branches that provided some loans. # ### SQL: # # SELECT DISTINCT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the names of the different banks that have provided loans? # ### SQL: # # SELECT DISTINCT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the name and credit score of the customers who have some loans. # ### SQL: # # SELECT DISTINCT T1.cust_name , T1.credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the different names and credit scores of customers who have taken a loan? # ### SQL: # # SELECT DISTINCT T1.cust_name , T1.credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the the name of the customers who have a loan with amount more than 3000. # ### SQL: # # SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE amount > 3000 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the names of customers who have a loan of more than 3000 in amount? # ### SQL: # # SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE amount > 3000 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the city and name of bank branches that provide business loans. # ### SQL: # # 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' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the names and cities of bank branches that offer loans for business? # ### SQL: # # 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' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the names of bank branches that have provided a loan to any customer whose credit score is below 100. # ### SQL: # # 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 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What are the names of banks that have loaned money to customers with credit scores below 100? # ### SQL: # # 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 # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the total amount of loans provided by bank branches in the state of New York. # ### SQL: # # SELECT sum(T2.amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id WHERE T1.state = 'New York' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What is the total amount of money loaned by banks in New York state? # ### SQL: # # SELECT sum(T2.amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id WHERE T1.state = 'New York' # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the average credit score of the customers who have some loan. # ### SQL: # # SELECT avg(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan) # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What is the average credit score for customers who have taken a loan? # ### SQL: # # SELECT avg(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan) # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # Find the average credit score of the customers who do not have any loan. # ### SQL: # # SELECT avg(credit_score) FROM customer WHERE cust_id NOT IN (SELECT cust_id FROM loan) # ### End.
loan_1
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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 can be joined with bank.branch_ID # loan.branch_ID can be joined with bank.branch_ID # ### Question: # # What is the average credit score for customers who have never taken a loan? # ### SQL: # # SELECT avg(credit_score) FROM customer WHERE cust_id NOT IN (SELECT cust_id FROM loan) # ### End.
behavior_monitoring
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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_postcode, state_province_county, country, other_address_details ) # Students ( student_id, address_id, first_name, middle_name, last_name, cell_mobile_number, email_address, date_first_rental, date_left_university, other_student_details ) # Teachers ( teacher_id, address_id, first_name, middle_name, last_name, gender, cell_mobile_number, email_address, other_details ) # Assessment_Notes ( notes_id, student_id, teacher_id, date_of_notes, text_of_notes, other_details ) # Behavior_Incident ( incident_id, incident_type_code, student_id, date_incident_start, date_incident_end, incident_summary, recommendations, other_details ) # Detention ( detention_id, detention_type_code, teacher_id, datetime_detention_start, datetime_detention_end, detention_summary, other_details ) # Student_Addresses ( student_id, address_id, date_address_from, date_address_to, monthly_rental, other_details ) # Students_in_Detention ( student_id, detention_id, incident_id ) # # Students.address_id can be joined with Addresses.address_id # Teachers.address_id can be joined with Addresses.address_id # Assessment_Notes.teacher_id can be joined with Teachers.teacher_id # Assessment_Notes.student_id can be joined with Students.student_id # Behavior_Incident.student_id can be joined with Students.student_id # Behavior_Incident.incident_type_code can be joined with Ref_Incident_Type.incident_type_code # Detention.teacher_id can be joined with Teachers.teacher_id # Detention.detention_type_code can be joined with Ref_Detention_Type.detention_type_code # Student_Addresses.student_id can be joined with Students.student_id # Student_Addresses.address_id can be joined with Addresses.address_id # Students_in_Detention.student_id can be joined with Students.student_id # Students_in_Detention.detention_id can be joined with Detention.detention_id # Students_in_Detention.incident_id can be joined with Behavior_Incident.incident_id # ### Question: # # How many assessment notes are there in total? # ### SQL: # # SELECT count(*) FROM ASSESSMENT_NOTES # ### End.
behavior_monitoring
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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_postcode, state_province_county, country, other_address_details ) # Students ( student_id, address_id, first_name, middle_name, last_name, cell_mobile_number, email_address, date_first_rental, date_left_university, other_student_details ) # Teachers ( teacher_id, address_id, first_name, middle_name, last_name, gender, cell_mobile_number, email_address, other_details ) # Assessment_Notes ( notes_id, student_id, teacher_id, date_of_notes, text_of_notes, other_details ) # Behavior_Incident ( incident_id, incident_type_code, student_id, date_incident_start, date_incident_end, incident_summary, recommendations, other_details ) # Detention ( detention_id, detention_type_code, teacher_id, datetime_detention_start, datetime_detention_end, detention_summary, other_details ) # Student_Addresses ( student_id, address_id, date_address_from, date_address_to, monthly_rental, other_details ) # Students_in_Detention ( student_id, detention_id, incident_id ) # # Students.address_id can be joined with Addresses.address_id # Teachers.address_id can be joined with Addresses.address_id # Assessment_Notes.teacher_id can be joined with Teachers.teacher_id # Assessment_Notes.student_id can be joined with Students.student_id # Behavior_Incident.student_id can be joined with Students.student_id # Behavior_Incident.incident_type_code can be joined with Ref_Incident_Type.incident_type_code # Detention.teacher_id can be joined with Teachers.teacher_id # Detention.detention_type_code can be joined with Ref_Detention_Type.detention_type_code # Student_Addresses.student_id can be joined with Students.student_id # Student_Addresses.address_id can be joined with Addresses.address_id # Students_in_Detention.student_id can be joined with Students.student_id # Students_in_Detention.detention_id can be joined with Detention.detention_id # Students_in_Detention.incident_id can be joined with Behavior_Incident.incident_id # ### Question: # # What are the dates of the assessment notes? # ### SQL: # # SELECT date_of_notes FROM Assessment_Notes # ### End.
behavior_monitoring
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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_postcode, state_province_county, country, other_address_details ) # Students ( student_id, address_id, first_name, middle_name, last_name, cell_mobile_number, email_address, date_first_rental, date_left_university, other_student_details ) # Teachers ( teacher_id, address_id, first_name, middle_name, last_name, gender, cell_mobile_number, email_address, other_details ) # Assessment_Notes ( notes_id, student_id, teacher_id, date_of_notes, text_of_notes, other_details ) # Behavior_Incident ( incident_id, incident_type_code, student_id, date_incident_start, date_incident_end, incident_summary, recommendations, other_details ) # Detention ( detention_id, detention_type_code, teacher_id, datetime_detention_start, datetime_detention_end, detention_summary, other_details ) # Student_Addresses ( student_id, address_id, date_address_from, date_address_to, monthly_rental, other_details ) # Students_in_Detention ( student_id, detention_id, incident_id ) # # Students.address_id can be joined with Addresses.address_id # Teachers.address_id can be joined with Addresses.address_id # Assessment_Notes.teacher_id can be joined with Teachers.teacher_id # Assessment_Notes.student_id can be joined with Students.student_id # Behavior_Incident.student_id can be joined with Students.student_id # Behavior_Incident.incident_type_code can be joined with Ref_Incident_Type.incident_type_code # Detention.teacher_id can be joined with Teachers.teacher_id # Detention.detention_type_code can be joined with Ref_Detention_Type.detention_type_code # Student_Addresses.student_id can be joined with Students.student_id # Student_Addresses.address_id can be joined with Addresses.address_id # Students_in_Detention.student_id can be joined with Students.student_id # Students_in_Detention.detention_id can be joined with Detention.detention_id # Students_in_Detention.incident_id can be joined with Behavior_Incident.incident_id # ### Question: # # How many addresses have zip code 197? # ### SQL: # # SELECT count(*) FROM ADDRESSES WHERE zip_postcode = "197" # ### End.
behavior_monitoring
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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_postcode, state_province_county, country, other_address_details ) # Students ( student_id, address_id, first_name, middle_name, last_name, cell_mobile_number, email_address, date_first_rental, date_left_university, other_student_details ) # Teachers ( teacher_id, address_id, first_name, middle_name, last_name, gender, cell_mobile_number, email_address, other_details ) # Assessment_Notes ( notes_id, student_id, teacher_id, date_of_notes, text_of_notes, other_details ) # Behavior_Incident ( incident_id, incident_type_code, student_id, date_incident_start, date_incident_end, incident_summary, recommendations, other_details ) # Detention ( detention_id, detention_type_code, teacher_id, datetime_detention_start, datetime_detention_end, detention_summary, other_details ) # Student_Addresses ( student_id, address_id, date_address_from, date_address_to, monthly_rental, other_details ) # Students_in_Detention ( student_id, detention_id, incident_id ) # # Students.address_id can be joined with Addresses.address_id # Teachers.address_id can be joined with Addresses.address_id # Assessment_Notes.teacher_id can be joined with Teachers.teacher_id # Assessment_Notes.student_id can be joined with Students.student_id # Behavior_Incident.student_id can be joined with Students.student_id # Behavior_Incident.incident_type_code can be joined with Ref_Incident_Type.incident_type_code # Detention.teacher_id can be joined with Teachers.teacher_id # Detention.detention_type_code can be joined with Ref_Detention_Type.detention_type_code # Student_Addresses.student_id can be joined with Students.student_id # Student_Addresses.address_id can be joined with Addresses.address_id # Students_in_Detention.student_id can be joined with Students.student_id # Students_in_Detention.detention_id can be joined with Detention.detention_id # Students_in_Detention.incident_id can be joined with Behavior_Incident.incident_id # ### Question: # # How many distinct incident type codes are there? # ### SQL: # # SELECT count(DISTINCT incident_type_code) FROM Behavior_Incident # ### End.
behavior_monitoring
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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_postcode, state_province_county, country, other_address_details ) # Students ( student_id, address_id, first_name, middle_name, last_name, cell_mobile_number, email_address, date_first_rental, date_left_university, other_student_details ) # Teachers ( teacher_id, address_id, first_name, middle_name, last_name, gender, cell_mobile_number, email_address, other_details ) # Assessment_Notes ( notes_id, student_id, teacher_id, date_of_notes, text_of_notes, other_details ) # Behavior_Incident ( incident_id, incident_type_code, student_id, date_incident_start, date_incident_end, incident_summary, recommendations, other_details ) # Detention ( detention_id, detention_type_code, teacher_id, datetime_detention_start, datetime_detention_end, detention_summary, other_details ) # Student_Addresses ( student_id, address_id, date_address_from, date_address_to, monthly_rental, other_details ) # Students_in_Detention ( student_id, detention_id, incident_id ) # # Students.address_id can be joined with Addresses.address_id # Teachers.address_id can be joined with Addresses.address_id # Assessment_Notes.teacher_id can be joined with Teachers.teacher_id # Assessment_Notes.student_id can be joined with Students.student_id # Behavior_Incident.student_id can be joined with Students.student_id # Behavior_Incident.incident_type_code can be joined with Ref_Incident_Type.incident_type_code # Detention.teacher_id can be joined with Teachers.teacher_id # Detention.detention_type_code can be joined with Ref_Detention_Type.detention_type_code # Student_Addresses.student_id can be joined with Students.student_id # Student_Addresses.address_id can be joined with Addresses.address_id # Students_in_Detention.student_id can be joined with Students.student_id # Students_in_Detention.detention_id can be joined with Detention.detention_id # Students_in_Detention.incident_id can be joined with Behavior_Incident.incident_id # ### Question: # # Return all distinct detention type codes. # ### SQL: # # SELECT DISTINCT detention_type_code FROM Detention # ### End.
behavior_monitoring
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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_postcode, state_province_county, country, other_address_details ) # Students ( student_id, address_id, first_name, middle_name, last_name, cell_mobile_number, email_address, date_first_rental, date_left_university, other_student_details ) # Teachers ( teacher_id, address_id, first_name, middle_name, last_name, gender, cell_mobile_number, email_address, other_details ) # Assessment_Notes ( notes_id, student_id, teacher_id, date_of_notes, text_of_notes, other_details ) # Behavior_Incident ( incident_id, incident_type_code, student_id, date_incident_start, date_incident_end, incident_summary, recommendations, other_details ) # Detention ( detention_id, detention_type_code, teacher_id, datetime_detention_start, datetime_detention_end, detention_summary, other_details ) # Student_Addresses ( student_id, address_id, date_address_from, date_address_to, monthly_rental, other_details ) # Students_in_Detention ( student_id, detention_id, incident_id ) # # Students.address_id can be joined with Addresses.address_id # Teachers.address_id can be joined with Addresses.address_id # Assessment_Notes.teacher_id can be joined with Teachers.teacher_id # Assessment_Notes.student_id can be joined with Students.student_id # Behavior_Incident.student_id can be joined with Students.student_id # Behavior_Incident.incident_type_code can be joined with Ref_Incident_Type.incident_type_code # Detention.teacher_id can be joined with Teachers.teacher_id # Detention.detention_type_code can be joined with Ref_Detention_Type.detention_type_code # Student_Addresses.student_id can be joined with Students.student_id # Student_Addresses.address_id can be joined with Addresses.address_id # Students_in_Detention.student_id can be joined with Students.student_id # Students_in_Detention.detention_id can be joined with Detention.detention_id # Students_in_Detention.incident_id can be joined with Behavior_Incident.incident_id # ### Question: # # What are the start and end dates for incidents with incident type code "NOISE"? # ### SQL: # # SELECT date_incident_start , date_incident_end FROM Behavior_Incident WHERE incident_type_code = "NOISE" # ### End.
behavior_monitoring
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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_postcode, state_province_county, country, other_address_details ) # Students ( student_id, address_id, first_name, middle_name, last_name, cell_mobile_number, email_address, date_first_rental, date_left_university, other_student_details ) # Teachers ( teacher_id, address_id, first_name, middle_name, last_name, gender, cell_mobile_number, email_address, other_details ) # Assessment_Notes ( notes_id, student_id, teacher_id, date_of_notes, text_of_notes, other_details ) # Behavior_Incident ( incident_id, incident_type_code, student_id, date_incident_start, date_incident_end, incident_summary, recommendations, other_details ) # Detention ( detention_id, detention_type_code, teacher_id, datetime_detention_start, datetime_detention_end, detention_summary, other_details ) # Student_Addresses ( student_id, address_id, date_address_from, date_address_to, monthly_rental, other_details ) # Students_in_Detention ( student_id, detention_id, incident_id ) # # Students.address_id can be joined with Addresses.address_id # Teachers.address_id can be joined with Addresses.address_id # Assessment_Notes.teacher_id can be joined with Teachers.teacher_id # Assessment_Notes.student_id can be joined with Students.student_id # Behavior_Incident.student_id can be joined with Students.student_id # Behavior_Incident.incident_type_code can be joined with Ref_Incident_Type.incident_type_code # Detention.teacher_id can be joined with Teachers.teacher_id # Detention.detention_type_code can be joined with Ref_Detention_Type.detention_type_code # Student_Addresses.student_id can be joined with Students.student_id # Student_Addresses.address_id can be joined with Addresses.address_id # Students_in_Detention.student_id can be joined with Students.student_id # Students_in_Detention.detention_id can be joined with Detention.detention_id # Students_in_Detention.incident_id can be joined with Behavior_Incident.incident_id # ### Question: # # Return all detention summaries. # ### SQL: # # SELECT detention_summary FROM Detention # ### End.
behavior_monitoring
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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_postcode, state_province_county, country, other_address_details ) # Students ( student_id, address_id, first_name, middle_name, last_name, cell_mobile_number, email_address, date_first_rental, date_left_university, other_student_details ) # Teachers ( teacher_id, address_id, first_name, middle_name, last_name, gender, cell_mobile_number, email_address, other_details ) # Assessment_Notes ( notes_id, student_id, teacher_id, date_of_notes, text_of_notes, other_details ) # Behavior_Incident ( incident_id, incident_type_code, student_id, date_incident_start, date_incident_end, incident_summary, recommendations, other_details ) # Detention ( detention_id, detention_type_code, teacher_id, datetime_detention_start, datetime_detention_end, detention_summary, other_details ) # Student_Addresses ( student_id, address_id, date_address_from, date_address_to, monthly_rental, other_details ) # Students_in_Detention ( student_id, detention_id, incident_id ) # # Students.address_id can be joined with Addresses.address_id # Teachers.address_id can be joined with Addresses.address_id # Assessment_Notes.teacher_id can be joined with Teachers.teacher_id # Assessment_Notes.student_id can be joined with Students.student_id # Behavior_Incident.student_id can be joined with Students.student_id # Behavior_Incident.incident_type_code can be joined with Ref_Incident_Type.incident_type_code # Detention.teacher_id can be joined with Teachers.teacher_id # Detention.detention_type_code can be joined with Ref_Detention_Type.detention_type_code # Student_Addresses.student_id can be joined with Students.student_id # Student_Addresses.address_id can be joined with Addresses.address_id # Students_in_Detention.student_id can be joined with Students.student_id # Students_in_Detention.detention_id can be joined with Detention.detention_id # Students_in_Detention.incident_id can be joined with Behavior_Incident.incident_id # ### Question: # # Return the cell phone number and email address for all students. # ### SQL: # # SELECT cell_mobile_number , email_address FROM STUDENTS # ### End.
behavior_monitoring
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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_postcode, state_province_county, country, other_address_details ) # Students ( student_id, address_id, first_name, middle_name, last_name, cell_mobile_number, email_address, date_first_rental, date_left_university, other_student_details ) # Teachers ( teacher_id, address_id, first_name, middle_name, last_name, gender, cell_mobile_number, email_address, other_details ) # Assessment_Notes ( notes_id, student_id, teacher_id, date_of_notes, text_of_notes, other_details ) # Behavior_Incident ( incident_id, incident_type_code, student_id, date_incident_start, date_incident_end, incident_summary, recommendations, other_details ) # Detention ( detention_id, detention_type_code, teacher_id, datetime_detention_start, datetime_detention_end, detention_summary, other_details ) # Student_Addresses ( student_id, address_id, date_address_from, date_address_to, monthly_rental, other_details ) # Students_in_Detention ( student_id, detention_id, incident_id ) # # Students.address_id can be joined with Addresses.address_id # Teachers.address_id can be joined with Addresses.address_id # Assessment_Notes.teacher_id can be joined with Teachers.teacher_id # Assessment_Notes.student_id can be joined with Students.student_id # Behavior_Incident.student_id can be joined with Students.student_id # Behavior_Incident.incident_type_code can be joined with Ref_Incident_Type.incident_type_code # Detention.teacher_id can be joined with Teachers.teacher_id # Detention.detention_type_code can be joined with Ref_Detention_Type.detention_type_code # Student_Addresses.student_id can be joined with Students.student_id # Student_Addresses.address_id can be joined with Addresses.address_id # Students_in_Detention.student_id can be joined with Students.student_id # Students_in_Detention.detention_id can be joined with Detention.detention_id # Students_in_Detention.incident_id can be joined with Behavior_Incident.incident_id # ### Question: # # What is the email of the student with first name "Emma" and last name "Rohan"? # ### SQL: # # SELECT email_address FROM Students WHERE first_name = "Emma" AND last_name = "Rohan" # ### End.
behavior_monitoring
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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_postcode, state_province_county, country, other_address_details ) # Students ( student_id, address_id, first_name, middle_name, last_name, cell_mobile_number, email_address, date_first_rental, date_left_university, other_student_details ) # Teachers ( teacher_id, address_id, first_name, middle_name, last_name, gender, cell_mobile_number, email_address, other_details ) # Assessment_Notes ( notes_id, student_id, teacher_id, date_of_notes, text_of_notes, other_details ) # Behavior_Incident ( incident_id, incident_type_code, student_id, date_incident_start, date_incident_end, incident_summary, recommendations, other_details ) # Detention ( detention_id, detention_type_code, teacher_id, datetime_detention_start, datetime_detention_end, detention_summary, other_details ) # Student_Addresses ( student_id, address_id, date_address_from, date_address_to, monthly_rental, other_details ) # Students_in_Detention ( student_id, detention_id, incident_id ) # # Students.address_id can be joined with Addresses.address_id # Teachers.address_id can be joined with Addresses.address_id # Assessment_Notes.teacher_id can be joined with Teachers.teacher_id # Assessment_Notes.student_id can be joined with Students.student_id # Behavior_Incident.student_id can be joined with Students.student_id # Behavior_Incident.incident_type_code can be joined with Ref_Incident_Type.incident_type_code # Detention.teacher_id can be joined with Teachers.teacher_id # Detention.detention_type_code can be joined with Ref_Detention_Type.detention_type_code # Student_Addresses.student_id can be joined with Students.student_id # Student_Addresses.address_id can be joined with Addresses.address_id # Students_in_Detention.student_id can be joined with Students.student_id # Students_in_Detention.detention_id can be joined with Detention.detention_id # Students_in_Detention.incident_id can be joined with Behavior_Incident.incident_id # ### Question: # # How many distinct students have been in detention? # ### SQL: # # SELECT count(DISTINCT student_id) FROM Students_in_Detention # ### End.
behavior_monitoring
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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_postcode, state_province_county, country, other_address_details ) # Students ( student_id, address_id, first_name, middle_name, last_name, cell_mobile_number, email_address, date_first_rental, date_left_university, other_student_details ) # Teachers ( teacher_id, address_id, first_name, middle_name, last_name, gender, cell_mobile_number, email_address, other_details ) # Assessment_Notes ( notes_id, student_id, teacher_id, date_of_notes, text_of_notes, other_details ) # Behavior_Incident ( incident_id, incident_type_code, student_id, date_incident_start, date_incident_end, incident_summary, recommendations, other_details ) # Detention ( detention_id, detention_type_code, teacher_id, datetime_detention_start, datetime_detention_end, detention_summary, other_details ) # Student_Addresses ( student_id, address_id, date_address_from, date_address_to, monthly_rental, other_details ) # Students_in_Detention ( student_id, detention_id, incident_id ) # # Students.address_id can be joined with Addresses.address_id # Teachers.address_id can be joined with Addresses.address_id # Assessment_Notes.teacher_id can be joined with Teachers.teacher_id # Assessment_Notes.student_id can be joined with Students.student_id # Behavior_Incident.student_id can be joined with Students.student_id # Behavior_Incident.incident_type_code can be joined with Ref_Incident_Type.incident_type_code # Detention.teacher_id can be joined with Teachers.teacher_id # Detention.detention_type_code can be joined with Ref_Detention_Type.detention_type_code # Student_Addresses.student_id can be joined with Students.student_id # Student_Addresses.address_id can be joined with Addresses.address_id # Students_in_Detention.student_id can be joined with Students.student_id # Students_in_Detention.detention_id can be joined with Detention.detention_id # Students_in_Detention.incident_id can be joined with Behavior_Incident.incident_id # ### Question: # # What is the gender of the teacher with last name "Medhurst"? # ### SQL: # # SELECT gender FROM TEACHERS WHERE last_name = "Medhurst" # ### End.
behavior_monitoring
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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_postcode, state_province_county, country, other_address_details ) # Students ( student_id, address_id, first_name, middle_name, last_name, cell_mobile_number, email_address, date_first_rental, date_left_university, other_student_details ) # Teachers ( teacher_id, address_id, first_name, middle_name, last_name, gender, cell_mobile_number, email_address, other_details ) # Assessment_Notes ( notes_id, student_id, teacher_id, date_of_notes, text_of_notes, other_details ) # Behavior_Incident ( incident_id, incident_type_code, student_id, date_incident_start, date_incident_end, incident_summary, recommendations, other_details ) # Detention ( detention_id, detention_type_code, teacher_id, datetime_detention_start, datetime_detention_end, detention_summary, other_details ) # Student_Addresses ( student_id, address_id, date_address_from, date_address_to, monthly_rental, other_details ) # Students_in_Detention ( student_id, detention_id, incident_id ) # # Students.address_id can be joined with Addresses.address_id # Teachers.address_id can be joined with Addresses.address_id # Assessment_Notes.teacher_id can be joined with Teachers.teacher_id # Assessment_Notes.student_id can be joined with Students.student_id # Behavior_Incident.student_id can be joined with Students.student_id # Behavior_Incident.incident_type_code can be joined with Ref_Incident_Type.incident_type_code # Detention.teacher_id can be joined with Teachers.teacher_id # Detention.detention_type_code can be joined with Ref_Detention_Type.detention_type_code # Student_Addresses.student_id can be joined with Students.student_id # Student_Addresses.address_id can be joined with Addresses.address_id # Students_in_Detention.student_id can be joined with Students.student_id # Students_in_Detention.detention_id can be joined with Detention.detention_id # Students_in_Detention.incident_id can be joined with Behavior_Incident.incident_id # ### Question: # # What is the incident type description for the incident type with code "VIOLENCE"? # ### SQL: # # SELECT incident_type_description FROM Ref_Incident_Type WHERE incident_type_code = "VIOLENCE" # ### End.
behavior_monitoring
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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_postcode, state_province_county, country, other_address_details ) # Students ( student_id, address_id, first_name, middle_name, last_name, cell_mobile_number, email_address, date_first_rental, date_left_university, other_student_details ) # Teachers ( teacher_id, address_id, first_name, middle_name, last_name, gender, cell_mobile_number, email_address, other_details ) # Assessment_Notes ( notes_id, student_id, teacher_id, date_of_notes, text_of_notes, other_details ) # Behavior_Incident ( incident_id, incident_type_code, student_id, date_incident_start, date_incident_end, incident_summary, recommendations, other_details ) # Detention ( detention_id, detention_type_code, teacher_id, datetime_detention_start, datetime_detention_end, detention_summary, other_details ) # Student_Addresses ( student_id, address_id, date_address_from, date_address_to, monthly_rental, other_details ) # Students_in_Detention ( student_id, detention_id, incident_id ) # # Students.address_id can be joined with Addresses.address_id # Teachers.address_id can be joined with Addresses.address_id # Assessment_Notes.teacher_id can be joined with Teachers.teacher_id # Assessment_Notes.student_id can be joined with Students.student_id # Behavior_Incident.student_id can be joined with Students.student_id # Behavior_Incident.incident_type_code can be joined with Ref_Incident_Type.incident_type_code # Detention.teacher_id can be joined with Teachers.teacher_id # Detention.detention_type_code can be joined with Ref_Detention_Type.detention_type_code # Student_Addresses.student_id can be joined with Students.student_id # Student_Addresses.address_id can be joined with Addresses.address_id # Students_in_Detention.student_id can be joined with Students.student_id # Students_in_Detention.detention_id can be joined with Detention.detention_id # Students_in_Detention.incident_id can be joined with Behavior_Incident.incident_id # ### Question: # # Find the maximum and minimum monthly rental for all student addresses. # ### SQL: # # SELECT max(monthly_rental) , min(monthly_rental) FROM Student_Addresses # ### End.
behavior_monitoring
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # 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_postcode, state_province_county, country, other_address_details ) # Students ( student_id, address_id, first_name, middle_name, last_name, cell_mobile_number, email_address, date_first_rental, date_left_university, other_student_details ) # Teachers ( teacher_id, address_id, first_name, middle_name, last_name, gender, cell_mobile_number, email_address, other_details ) # Assessment_Notes ( notes_id, student_id, teacher_id, date_of_notes, text_of_notes, other_details ) # Behavior_Incident ( incident_id, incident_type_code, student_id, date_incident_start, date_incident_end, incident_summary, recommendations, other_details ) # Detention ( detention_id, detention_type_code, teacher_id, datetime_detention_start, datetime_detention_end, detention_summary, other_details ) # Student_Addresses ( student_id, address_id, date_address_from, date_address_to, monthly_rental, other_details ) # Students_in_Detention ( student_id, detention_id, incident_id ) # # Students.address_id can be joined with Addresses.address_id # Teachers.address_id can be joined with Addresses.address_id # Assessment_Notes.teacher_id can be joined with Teachers.teacher_id # Assessment_Notes.student_id can be joined with Students.student_id # Behavior_Incident.student_id can be joined with Students.student_id # Behavior_Incident.incident_type_code can be joined with Ref_Incident_Type.incident_type_code # Detention.teacher_id can be joined with Teachers.teacher_id # Detention.detention_type_code can be joined with Ref_Detention_Type.detention_type_code # Student_Addresses.student_id can be joined with Students.student_id # Student_Addresses.address_id can be joined with Addresses.address_id # Students_in_Detention.student_id can be joined with Students.student_id # Students_in_Detention.detention_id can be joined with Detention.detention_id # Students_in_Detention.incident_id can be joined with Behavior_Incident.incident_id # ### Question: # # Find the first names of teachers whose email address contains the word "man". # ### SQL: # # SELECT first_name FROM Teachers WHERE email_address LIKE '%man%' # ### End.