cnatale/presto-athena-txt-2-sql huggingface dataset:
Return the amount of the largest payment.
Additional table information: table: sakila_1
SQL: SELECT amount FROM payment ORDER BY amount DESC LIMIT 1
Where does the staff member with the first name Elsa live?
Additional table information: table: sakila_1
SQL: SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Elsa'
Give the address of the staff member who has the first name Elsa.
Additional table information: table: sakila_1
SQL: SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Elsa'
What are the first names of customers who have not rented any films after '2005-08-23 02:06:01'?
Additional table information: table: sakila_1
SQL: SELECT first_name FROM customer WHERE NOT customer_id IN (SELECT customer_id FROM rental WHERE rental_date > '2005-08-23 02:06:01')
Return the first names of customers who did not rented a film after the date '2005-08-23 02:06:01'.
Additional table information: table: sakila_1
SQL: SELECT first_name FROM customer WHERE NOT customer_id IN (SELECT customer_id FROM rental WHERE rental_date > '2005-08-23 02:06:01')
How many bank branches are there?
Additional table information: table: loan_1
SQL: SELECT COUNT(*) FROM bank
Count the number of bank branches.
Additional table information: table: loan_1
SQL: SELECT COUNT(*) FROM bank
How many customers are there?
Additional table information: table: loan_1
SQL: SELECT SUM(no_of_customers) FROM bank
What is the total number of customers across banks?
Additional table information: table: loan_1
SQL: SELECT SUM(no_of_customers) FROM bank
Find the number of customers in the banks at New York City.
Additional table information: table: loan_1
SQL: SELECT SUM(no_of_customers) FROM bank WHERE city = 'New York City'
What is the total number of customers who use banks in New York City?
Additional table information: table: loan_1
SQL: SELECT SUM(no_of_customers) FROM bank WHERE city = 'New York City'
Find the average number of customers in all banks of Utah state.
Additional table information: table: loan_1
SQL: SELECT AVG(no_of_customers) FROM bank WHERE state = 'Utah'
What is the average number of customers across banks in the state of Utah?
Additional table information: table: loan_1
SQL: SELECT AVG(no_of_customers) FROM bank WHERE state = 'Utah'
Find the average number of customers cross all banks.
Additional table information: table: loan_1
SQL: SELECT AVG(no_of_customers) FROM bank
What is the average number of bank customers?
Additional table information: table: loan_1
SQL: SELECT AVG(no_of_customers) FROM bank
Find the city and state of the bank branch named morningside.
Additional table information: table: loan_1
SQL: SELECT city, state FROM bank WHERE bname = 'morningside'
What city and state is the bank with the name morningside in?
Additional table information: table: loan_1
SQL: SELECT city, state FROM bank WHERE bname = 'morningside'
Find the branch names of banks in the New York state.
Additional table information: table: loan_1
SQL: SELECT bname FROM bank WHERE state = 'New York'
What are the names of banks in the state of New York?
Additional table information: table: loan_1
SQL: SELECT bname FROM bank WHERE state = 'New York'
List the name of all customers sorted by their account balance in ascending order.
Additional table information: table: loan_1
SQL: SELECT cust_name FROM customer ORDER BY acc_bal NULLS FIRST
What are the names of all customers, ordered by account balance?
Additional table information: table: loan_1
SQL: SELECT cust_name FROM customer ORDER BY acc_bal NULLS FIRST
List the name of all different customers who have some loan sorted by their total loan amount.
Additional table information: table: loan_1
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) NULLS FIRST
What are the names of the different customers who have taken out a loan, ordered by the total amount that they have taken?
Additional table information: table: loan_1
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) NULLS FIRST
Find the state, account type, and credit score of the customer whose number of loan is 0.
Additional table information: table: loan_1
SQL: SELECT state, acc_type, credit_score FROM customer WHERE no_of_loans = 0
What are the states, account types, and credit scores for customers who have 0 loans?
Additional table information: table: loan_1
SQL: SELECT state, acc_type, credit_score FROM customer WHERE no_of_loans = 0
Find the number of different cities which banks are located at.
Additional table information: table: loan_1
SQL: SELECT COUNT(DISTINCT city) FROM bank
In how many different cities are banks located?
Additional table information: table: loan_1
SQL: SELECT COUNT(DISTINCT city) FROM bank
Find the number of different states which banks are located at.
Additional table information: table: loan_1
SQL: SELECT COUNT(DISTINCT state) FROM bank
In how many different states are banks located?
Additional table information: table: loan_1
SQL: SELECT COUNT(DISTINCT state) FROM bank
How many distinct types of accounts are there?
Additional table information: table: loan_1
SQL: SELECT COUNT(DISTINCT acc_type) FROM customer
Count the number of different account types.
Additional table information: table: loan_1
SQL: SELECT COUNT(DISTINCT acc_type) FROM customer
Find the name and account balance of the customer whose name includes the letter ‘a’.
Additional table information: table: loan_1
SQL: SELECT cust_name, acc_bal FROM customer WHERE cust_name LIKE '%a%'
What are the names and account balances of customers with the letter a in their names?
Additional table information: table: loan_1
SQL: SELECT cust_name, acc_bal FROM customer WHERE cust_name LIKE '%a%'
Find the total account balance of each customer from Utah or Texas.
Additional table information: table: loan_1
SQL: SELECT SUM(acc_bal) FROM customer WHERE state = 'Utah' OR state = 'Texas'
What are the total account balances for each customer from Utah or Texas?
Additional table information: table: loan_1
SQL: SELECT SUM(acc_bal) FROM customer WHERE state = 'Utah' OR state = 'Texas'
Find the name of customers who have both saving and checking account types.
Additional table information: table: loan_1
SQL: SELECT cust_name FROM customer WHERE acc_type = 'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type = 'checking'
What are the names of customers who have both savings and checking accounts?
Additional table information: table: loan_1
SQL: SELECT cust_name FROM customer WHERE acc_type = 'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type = 'checking'
Find the name of customers who do not have an saving account.
Additional table information: table: loan_1
SQL: SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving'
What are the names of customers who do not have saving accounts?
Additional table information: table: loan_1
SQL: SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving'
Find the name of customers who do not have a loan with a type of Mortgages.
Additional table information: table: loan_1
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'
What are the names of customers who have not taken a Mortage loan?
Additional table information: table: loan_1
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'
Find the name of customers who have loans of both Mortgages and Auto.
Additional table information: table: loan_1
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'
What are the names of customers who have taken both Mortgage and Auto loans?
Additional table information: table: loan_1
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'
Find the name of customers whose credit score is below the average credit scores of all customers.
Additional table information: table: loan_1
SQL: SELECT cust_name FROM customer WHERE credit_score < (SELECT AVG(credit_score) FROM customer)
What are the names of customers with credit score less than the average credit score across customers?
Additional table information: table: loan_1
SQL: SELECT cust_name FROM customer WHERE credit_score < (SELECT AVG(credit_score) FROM customer)
Find the branch name of the bank that has the most number of customers.
Additional table information: table: loan_1
SQL: SELECT bname FROM bank ORDER BY no_of_customers DESC LIMIT 1
What is the name of the bank branch with the greatest number of customers?
Additional table information: table: loan_1
SQL: SELECT bname FROM bank ORDER BY no_of_customers DESC LIMIT 1
Find the name of customer who has the lowest credit score.
Additional table information: table: loan_1
SQL: SELECT cust_name FROM customer ORDER BY credit_score NULLS FIRST LIMIT 1
What is the name of the customer with the worst credit score?
Additional table information: table: loan_1
SQL: SELECT cust_name FROM customer ORDER BY credit_score NULLS FIRST LIMIT 1
Find the name, account type, and account balance of the customer who has the highest credit score.
Additional table information: table: loan_1
SQL: SELECT cust_name, acc_type, acc_bal FROM customer ORDER BY credit_score DESC LIMIT 1
What is the name, account type, and account balance corresponding to the customer with the highest credit score?
Additional table information: table: loan_1
SQL: SELECT cust_name, acc_type, acc_bal FROM customer ORDER BY credit_score DESC LIMIT 1
Find the name of customer who has the highest amount of loans.
Additional table information: table: loan_1
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
What is the name of the customer who has greatest total loan amount?
Additional table information: table: loan_1
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
Find the state which has the most number of customers.
Additional table information: table: loan_1
SQL: SELECT state FROM bank GROUP BY state ORDER BY SUM(no_of_customers) DESC LIMIT 1
Which state has the greatest total number of bank customers?
Additional table information: table: loan_1
SQL: SELECT state FROM bank GROUP BY state ORDER BY SUM(no_of_customers) DESC LIMIT 1
For each account type, find the average account balance of customers with credit score lower than 50.
Additional table information: table: loan_1
SQL: SELECT AVG(acc_bal), acc_type FROM customer WHERE credit_score < 50 GROUP BY acc_type
What is the average account balance of customers with credit score below 50 for the different account types?
Additional table information: table: loan_1
SQL: SELECT AVG(acc_bal), acc_type FROM customer WHERE credit_score < 50 GROUP BY acc_type
For each state, find the total account balance of customers whose credit score is above 100.
Additional table information: table: loan_1
SQL: SELECT SUM(acc_bal), state FROM customer WHERE credit_score > 100 GROUP BY state
What is the total account balance for customers with a credit score of above 100 for the different states?
Additional table information: table: loan_1
SQL: SELECT SUM(acc_bal), state FROM customer WHERE credit_score > 100 GROUP BY state
Find the total amount of loans offered by each bank branch.
Additional table information: table: loan_1
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
What are the names of the different bank branches, and what are their total loan amounts?
Additional table information: table: loan_1
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
Find the name of customers who have more than one loan.
Additional table information: table: loan_1
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
What are the names of customers who have taken out more than one loan?
Additional table information: table: loan_1
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
Find the name and account balance of the customers who have loans with a total amount of more than 5000.
Additional table information: table: loan_1
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
What are the names and account balances for customers who have taken a total amount of more than 5000 in loans?
Additional table information: table: loan_1
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
Find the name of bank branch that provided the greatest total amount of loans.
Additional table information: table: loan_1
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
What is the name of the bank branch that has lent the greatest amount?
Additional table information: table: loan_1
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
Find the name of bank branch that provided the greatest total amount of loans to customers with credit score is less than 100.
Additional table information: table: loan_1
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
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?
Additional table information: table: loan_1
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
Find the name of bank branches that provided some loans.
Additional table information: table: loan_1
SQL: SELECT DISTINCT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id
What are the names of the different banks that have provided loans?
Additional table information: table: loan_1
SQL: SELECT DISTINCT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id
Find the name and credit score of the customers who have some loans.
Additional table information: table: loan_1
SQL: SELECT DISTINCT T1.cust_name, T1.credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id
What are the different names and credit scores of customers who have taken a loan?
Additional table information: table: loan_1
SQL: SELECT DISTINCT T1.cust_name, T1.credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id
Find the the name of the customers who have a loan with amount more than 3000.
Additional table information: table: loan_1
SQL: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE amount > 3000
What are the names of customers who have a loan of more than 3000 in amount?
Additional table information: table: loan_1
SQL: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE amount > 3000
Find the city and name of bank branches that provide business loans.
Additional table information: table: loan_1
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'
What are the names and cities of bank branches that offer loans for business?
Additional table information: table: loan_1
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'
Find the names of bank branches that have provided a loan to any customer whose credit score is below 100.
Additional table information: table: loan_1
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
What are the names of banks that have loaned money to customers with credit scores below 100?
Additional table information: table: loan_1
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
Find the total amount of loans provided by bank branches in the state of New York.
Additional table information: table: loan_1
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'
What is the total amount of money loaned by banks in New York state?
Additional table information: table: loan_1
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'
Find the average credit score of the customers who have some loan.
Additional table information: table: loan_1
SQL: SELECT AVG(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan)
What is the average credit score for customers who have taken a loan?
Additional table information: table: loan_1
SQL: SELECT AVG(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan)
Find the average credit score of the customers who do not have any loan.
Additional table information: table: loan_1
SQL: SELECT AVG(credit_score) FROM customer WHERE NOT cust_id IN (SELECT cust_id FROM loan)
What is the average credit score for customers who have never taken a loan?
Additional table information: table: loan_1
SQL: SELECT AVG(credit_score) FROM customer WHERE NOT cust_id IN (SELECT cust_id FROM loan)
How many assessment notes are there in total?
Additional table information: table: behavior_monitoring
SQL: SELECT COUNT(*) FROM ASSESSMENT_NOTES
What are the dates of the assessment notes?
Additional table information: table: behavior_monitoring
SQL: SELECT date_of_notes FROM Assessment_Notes
How many addresses have zip code 197?
Additional table information: table: behavior_monitoring
SQL: SELECT COUNT(*) FROM ADDRESSES WHERE zip_postcode = '197'
How many distinct incident type codes are there?
Additional table information: table: behavior_monitoring
SQL: SELECT COUNT(DISTINCT incident_type_code) FROM Behavior_Incident
Return all distinct detention type codes.
Additional table information: table: behavior_monitoring
SQL: SELECT DISTINCT detention_type_code FROM Detention
What are the start and end dates for incidents with incident type code 'NOISE'?
Additional table information: table: behavior_monitoring
SQL: SELECT date_incident_start, date_incident_end FROM Behavior_Incident WHERE incident_type_code = 'NOISE'
Return all detention summaries.
Additional table information: table: behavior_monitoring
SQL: SELECT detention_summary FROM Detention
Return the cell phone number and email address for all students.
Additional table information: table: behavior_monitoring
SQL: SELECT cell_mobile_number, email_address FROM STUDENTS
What is the email of the student with first name 'Emma' and last name 'Rohan'?
Additional table information: table: behavior_monitoring
SQL: SELECT email_address FROM Students WHERE first_name = 'Emma' AND last_name = 'Rohan'
How many distinct students have been in detention?
Additional table information: table: behavior_monitoring
SQL: SELECT COUNT(DISTINCT student_id) FROM Students_in_Detention
What is the gender of the teacher with last name 'Medhurst'?
Additional table information: table: behavior_monitoring
SQL: SELECT gender FROM TEACHERS WHERE last_name = 'Medhurst'
What is the incident type description for the incident type with code 'VIOLENCE'?
Additional table information: table: behavior_monitoring
SQL: SELECT incident_type_description FROM Ref_Incident_Type WHERE incident_type_code = 'VIOLENCE'
Find the maximum and minimum monthly rental for all student addresses.
Additional table information: table: behavior_monitoring
SQL: SELECT MAX(monthly_rental), MIN(monthly_rental) FROM Student_Addresses
Find the first names of teachers whose email address contains the word 'man'.
Additional table information: table: behavior_monitoring
SQL: SELECT first_name FROM Teachers WHERE email_address LIKE '%man%'
List all information about the assessment notes sorted by date in ascending order.
Additional table information: table: behavior_monitoring
SQL: SELECT * FROM Assessment_Notes ORDER BY date_of_notes ASC NULLS FIRST
List all cities of addresses in alphabetical order.
Additional table information: table: behavior_monitoring
SQL: SELECT city FROM Addresses ORDER BY city NULLS FIRST
Find the first names and last names of teachers in alphabetical order of last name.
Additional table information: table: behavior_monitoring
SQL: SELECT first_name, last_name FROM Teachers ORDER BY last_name NULLS FIRST
Find all information about student addresses, and sort by monthly rental in descending order.
Additional table information: table: behavior_monitoring
SQL: SELECT * FROM Student_Addresses ORDER BY monthly_rental DESC
Find the id and first name of the student that has the most number of assessment notes?
Additional table information: table: behavior_monitoring
SQL: SELECT T1.student_id, T2.first_name FROM Assessment_Notes AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1
Find the ids and first names of the 3 teachers that have the most number of assessment notes?
Additional table information: table: behavior_monitoring
SQL: SELECT T1.teacher_id, T2.first_name FROM Assessment_Notes AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id GROUP BY T1.teacher_id ORDER BY COUNT(*) DESC LIMIT 3
Find the id and last name of the student that has the most behavior incidents?
Additional table information: table: behavior_monitoring
SQL: SELECT T1.student_id, T2.last_name FROM Behavior_Incident AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1
Find the id and last name of the teacher that has the most detentions with detention type code 'AFTER'?
Additional table information: table: behavior_monitoring
SQL: SELECT T1.teacher_id, T2.last_name FROM Detention AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T1.detention_type_code = 'AFTER' GROUP BY T1.teacher_id ORDER BY COUNT(*) DESC LIMIT 1
What are the id and first name of the student whose addresses have the highest average monthly rental?
Additional table information: table: behavior_monitoring
SQL: SELECT T1.student_id, T2.first_name FROM Student_Addresses AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY AVG(monthly_rental) DESC LIMIT 1
Find the id and city of the student address with the highest average monthly rental.
Additional table information: table: behavior_monitoring
SQL: SELECT T2.address_id, T1.city FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id GROUP BY T2.address_id ORDER BY AVG(monthly_rental) DESC LIMIT 1
What are the code and description of the most frequent behavior incident type?
Additional table information: table: behavior_monitoring
SQL: SELECT T1.incident_type_code, T2.incident_type_description FROM Behavior_Incident AS T1 JOIN Ref_Incident_Type AS T2 ON T1.incident_type_code = T2.incident_type_code GROUP BY T1.incident_type_code ORDER BY COUNT(*) DESC LIMIT 1
What are the code and description of the least frequent detention type ?
Additional table information: table: behavior_monitoring
SQL: SELECT T1.detention_type_code, T2.detention_type_description FROM Detention AS T1 JOIN Ref_Detention_Type AS T2 ON T1.detention_type_code = T2.detention_type_code GROUP BY T1.detention_type_code ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
Find the dates of assessment notes for students with first name 'Fanny'.
Additional table information: table: behavior_monitoring
SQL: SELECT T1.date_of_notes FROM Assessment_Notes AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.first_name = 'Fanny'
Find the texts of assessment notes for teachers with last name 'Schuster'.
Additional table information: table: behavior_monitoring
SQL: SELECT T1.text_of_notes FROM Assessment_Notes AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.last_name = 'Schuster'
Find the start and end dates of behavior incidents of students with last name 'Fahey'.
Additional table information: table: behavior_monitoring
SQL: SELECT T1.date_incident_start, date_incident_end FROM Behavior_Incident AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.last_name = 'Fahey'
Find the start and end dates of detentions of teachers with last name 'Schultz'.
Additional table information: table: behavior_monitoring
SQL: SELECT T1.datetime_detention_start, datetime_detention_end FROM Detention AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.last_name = 'Schultz'
What are the id and zip code of the address with the highest monthly rental?
Additional table information: table: behavior_monitoring
SQL: SELECT T2.address_id, T1.zip_postcode FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id ORDER BY monthly_rental DESC LIMIT 1
What is the cell phone number of the student whose address has the lowest monthly rental?
Additional table information: table: behavior_monitoring
SQL: SELECT T2.cell_mobile_number FROM Student_Addresses AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.monthly_rental ASC NULLS FIRST LIMIT 1
What are the monthly rentals of student addresses in Texas state?
Additional table information: table: behavior_monitoring
SQL: SELECT T2.monthly_rental FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id WHERE T1.state_province_county = 'Texas'
What are the first names and last names of students with address in Wisconsin state?
Additional table information: table: behavior_monitoring
SQL: SELECT T2.first_name, T2.last_name FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id = T2.address_id WHERE T1.state_province_county = 'Wisconsin'
What are the line 1 and average monthly rentals of all student addresses?
Additional table information: table: behavior_monitoring
SQL: SELECT T1.line_1, AVG(T2.monthly_rental) FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id GROUP BY T2.address_id
What is the zip code of the address where the teacher with first name 'Lyla' lives?
Additional table information: table: behavior_monitoring
SQL: SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'Lyla'
What are the email addresses of teachers whose address has zip code '918'?
Additional table information: table: behavior_monitoring
SQL: SELECT T2.email_address FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T1.zip_postcode = '918'
How many students are not involved in any behavior incident?
Additional table information: table: behavior_monitoring
SQL: SELECT COUNT(*) FROM STUDENTS WHERE NOT student_id IN (SELECT student_id FROM Behavior_Incident)
Find the last names of teachers who are not involved in any detention.
Additional table information: table: behavior_monitoring
SQL: SELECT last_name FROM Teachers EXCEPT SELECT T1.last_name FROM Teachers AS T1 JOIN Detention AS T2 ON T1.teacher_id = T2.teacher_id
What are the line 1 of addresses shared by some students and some teachers?
Additional table information: table: behavior_monitoring
SQL: SELECT T1.line_1 FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id = T2.address_id INTERSECT SELECT T1.line_1 FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id
Which assets have 2 parts and have less than 2 fault logs? List the asset id and detail.
Additional table information: table: assets_maintenance
SQL: SELECT T1.asset_id, T1.asset_details FROM Assets AS T1 JOIN Asset_Parts AS T2 ON T1.asset_id = T2.asset_id GROUP BY T1.asset_id HAVING COUNT(*) = 2 INTERSECT SELECT T1.asset_id, T1.asset_details FROM Assets AS T1 JOIN Fault_Log AS T2 ON T1.asset_id = T2.asset_id GROUP BY T1.asset_id HAVING COUNT(*) < 2
How many assets does each maintenance contract contain? List the number and the contract id.
Additional table information: table: assets_maintenance
SQL: SELECT COUNT(*), T1.maintenance_contract_id FROM Maintenance_Contracts AS T1 JOIN Assets AS T2 ON T1.maintenance_contract_id = T2.maintenance_contract_id GROUP BY T1.maintenance_contract_id
How many assets does each third party company supply? List the count and the company id.
Additional table information: table: assets_maintenance
SQL: SELECT COUNT(*), T1.company_id FROM Third_Party_Companies AS T1 JOIN Assets AS T2 ON T1.company_id = T2.supplier_company_id GROUP BY T1.company_id
Which third party companies have at least 2 maintenance engineers or have at least 2 maintenance contracts? List the company id and name.
Additional table information: table: assets_maintenance
SQL: SELECT T1.company_id, T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Engineers AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id HAVING COUNT(*) >= 2 UNION SELECT T3.company_id, T3.company_name FROM Third_Party_Companies AS T3 JOIN Maintenance_Contracts AS T4 ON T3.company_id = T4.maintenance_contract_company_id GROUP BY T3.company_id HAVING COUNT(*) >= 2
What is the name and id of the staff who recorded the fault log but has not contacted any visiting engineers?
Additional table information: table: assets_maintenance
SQL: SELECT T1.staff_name, T1.staff_id FROM Staff AS T1 JOIN Fault_Log AS T2 ON T1.staff_id = T2.recorded_by_staff_id EXCEPT SELECT T3.staff_name, T3.staff_id FROM Staff AS T3 JOIN Engineer_Visits AS T4 ON T3.staff_id = T4.contact_staff_id
Which engineer has visited the most times? Show the engineer id, first name and last name.
Additional table information: table: assets_maintenance
SQL: SELECT T1.engineer_id, T1.first_name, T1.last_name FROM Maintenance_Engineers AS T1, Engineer_Visits AS T2 GROUP BY T1.engineer_id ORDER BY COUNT(*) DESC LIMIT 1
Which parts have more than 2 faults? Show the part name and id.
Additional table information: table: assets_maintenance
SQL: SELECT T1.part_name, T1.part_id FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_id HAVING COUNT(*) > 2
List all every engineer's first name, last name, details and coresponding skill description.
Additional table information: table: assets_maintenance
SQL: SELECT T1.first_name, T1.last_name, T1.other_details, T3.skill_description FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id
For all the faults of different parts, what are all the decriptions of the skills required to fix them? List the name of the faults and the skill description.
Additional table information: table: assets_maintenance
SQL: SELECT T1.fault_short_name, T3.skill_description FROM Part_Faults AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.part_fault_id = T2.part_fault_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id
How many assets can each parts be used in? List the part name and the number.
Additional table information: table: assets_maintenance
SQL: SELECT T1.part_name, COUNT(*) FROM Parts AS T1 JOIN Asset_Parts AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name
What are all the fault descriptions and the fault status of all the faults recoreded in the logs?
Additional table information: table: assets_maintenance
SQL: SELECT T1.fault_description, T2.fault_status FROM Fault_Log AS T1 JOIN Fault_Log_Parts AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id
How many engineer visits are required at most for a single fault log? List the number and the log entry id.
Additional table information: table: assets_maintenance
SQL: SELECT COUNT(*), T1.fault_log_entry_id FROM Fault_Log AS T1 JOIN Engineer_Visits AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id ORDER BY COUNT(*) DESC LIMIT 1
What are all the distinct last names of all the engineers?
Additional table information: table: assets_maintenance
SQL: SELECT DISTINCT last_name FROM Maintenance_Engineers
How many fault status codes are recorded in the fault log parts table?
Additional table information: table: assets_maintenance
SQL: SELECT DISTINCT fault_status FROM Fault_Log_Parts
Which engineers have never visited to maintain the assets? List the engineer first name and last name.
Additional table information: table: assets_maintenance
SQL: SELECT first_name, last_name FROM Maintenance_Engineers WHERE NOT engineer_id IN (SELECT engineer_id FROM Engineer_Visits)
List the asset id, details, make and model for every asset.
Additional table information: table: assets_maintenance
SQL: SELECT asset_id, asset_details, asset_make, asset_model FROM Assets
When was the first asset acquired?
Additional table information: table: assets_maintenance
SQL: SELECT asset_acquired_date FROM Assets ORDER BY asset_acquired_date ASC NULLS FIRST LIMIT 1
Which part fault requires the most number of skills to fix? List part id and name.
Additional table information: table: assets_maintenance
SQL: SELECT T1.part_id, T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id JOIN Skills_Required_To_Fix AS T3 ON T2.part_fault_id = T3.part_fault_id GROUP BY T1.part_id ORDER BY COUNT(*) DESC LIMIT 1
Which kind of part has the least number of faults? List the part name.
Additional table information: table: assets_maintenance
SQL: SELECT T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
Among those engineers who have visited, which engineer makes the least number of visits? List the engineer id, first name and last name.
Additional table information: table: assets_maintenance
SQL: SELECT T1.engineer_id, T1.first_name, T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 ON T1.engineer_id = T2.engineer_id GROUP BY T1.engineer_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1
Which staff have contacted which engineers? List the staff name and the engineer first name and last name.
Additional table information: table: assets_maintenance
SQL: SELECT T1.staff_name, T3.first_name, T3.last_name FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id JOIN Maintenance_Engineers AS T3 ON T2.engineer_id = T3.engineer_id
Which fault log included the most number of faulty parts? List the fault log id, description and record time.
Additional table information: table: assets_maintenance
SQL: SELECT T1.fault_log_entry_id, T1.fault_description, T1.fault_log_entry_datetime FROM Fault_Log AS T1 JOIN Fault_Log_Parts AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id ORDER BY COUNT(*) DESC LIMIT 1
Which skill is used in fixing the most number of faults? List the skill id and description.
Additional table information: table: assets_maintenance
SQL: SELECT T1.skill_id, T1.skill_description FROM Skills AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.skill_id = T2.skill_id GROUP BY T1.skill_id ORDER BY COUNT(*) DESC LIMIT 1
What are all the distinct asset models?
Additional table information: table: assets_maintenance
SQL: SELECT DISTINCT asset_model FROM Assets
List the all the assets make, model, details by the disposed date ascendingly.
Additional table information: table: assets_maintenance
SQL: SELECT asset_make, asset_model, asset_details FROM Assets ORDER BY asset_disposed_date ASC NULLS FIRST
Which part has the least chargeable amount? List the part id and amount.
Additional table information: table: assets_maintenance
SQL: SELECT part_id, chargeable_amount FROM Parts ORDER BY chargeable_amount ASC NULLS FIRST LIMIT 1
Which company started the earliest the maintenance contract? Show the company name.
Additional table information: table: assets_maintenance
SQL: SELECT T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Contracts AS T2 ON T1.company_id = T2.maintenance_contract_company_id ORDER BY T2.contract_start_date ASC NULLS FIRST LIMIT 1
What is the description of the type of the company who concluded its contracts most recently?
Additional table information: table: assets_maintenance
SQL: SELECT T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Contracts AS T2 ON T1.company_id = T2.maintenance_contract_company_id JOIN Ref_Company_Types AS T3 ON T1.company_type_code = T3.company_type_code ORDER BY T2.contract_end_date DESC LIMIT 1
Which gender makes up the majority of the staff?
Additional table information: table: assets_maintenance
SQL: SELECT gender FROM staff GROUP BY gender ORDER BY COUNT(*) DESC LIMIT 1
How many engineers did each staff contact? List both the contact staff name and number of engineers contacted.
Additional table information: table: assets_maintenance
SQL: SELECT T1.staff_name, COUNT(*) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id GROUP BY T1.staff_name
Which assets did not incur any fault log? List the asset model.
Additional table information: table: assets_maintenance
SQL: SELECT asset_model FROM Assets WHERE NOT asset_id IN (SELECT asset_id FROM Fault_Log)
list the local authorities and services provided by all stations.
Additional table information: table: station_weather
SQL: SELECT local_authority, services FROM station
show all train numbers and names ordered by their time from early to late.
Additional table information: table: station_weather
SQL: SELECT train_number, name FROM train ORDER BY TIME NULLS FIRST
Give me the times and numbers of all trains that go to Chennai, ordered by time.
Additional table information: table: station_weather
SQL: SELECT TIME, train_number FROM train WHERE destination = 'Chennai' ORDER BY TIME NULLS FIRST
How many trains have 'Express' in their names?
Additional table information: table: station_weather
SQL: SELECT COUNT(*) FROM train WHERE name LIKE '%Express%'
Find the number and time of the train that goes from Chennai to Guruvayur.
Additional table information: table: station_weather
SQL: SELECT train_number, TIME FROM train WHERE origin = 'Chennai' AND destination = 'Guruvayur'
Find the number of trains starting from each origin.
Additional table information: table: station_weather
SQL: SELECT origin, COUNT(*) FROM train GROUP BY origin
Find the name of the train whose route runs through greatest number of stations.
Additional table information: table: station_weather
SQL: SELECT t1.name FROM train AS t1 JOIN route AS t2 ON t1.id = t2.train_id GROUP BY t2.train_id ORDER BY COUNT(*) DESC LIMIT 1
Find the number of trains for each station, as well as the station network name and services.
Additional table information: table: station_weather
SQL: SELECT COUNT(*), t1.network_name, t1.services FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id GROUP BY t2.station_id
What is the average high temperature for each day of week?
Additional table information: table: station_weather
SQL: SELECT AVG(high_temperature), day_of_week FROM weekly_weather GROUP BY day_of_week
Give me the maximum low temperature and average precipitation at the Amersham station.
Additional table information: table: station_weather
SQL: SELECT MAX(t1.low_temperature), AVG(t1.precipitation) FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id WHERE t2.network_name = 'Amersham'
Find names and times of trains that run through stations for the local authority Chiltern.
Additional table information: table: station_weather
SQL: SELECT t3.name, t3.time FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id JOIN train AS t3 ON t2.train_id = t3.id WHERE t1.local_authority = 'Chiltern'
How many different services are provided by all stations?
Additional table information: table: station_weather
SQL: SELECT COUNT(DISTINCT services) FROM station
Find the id and local authority of the station with has the highest average high temperature.
Additional table information: table: station_weather
SQL: SELECT t2.id, t2.local_authority FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id GROUP BY t1.station_id ORDER BY AVG(high_temperature) DESC LIMIT 1
Find the id and local authority of the station whose maximum precipitation is higher than 50.
Additional table information: table: station_weather
SQL: SELECT t2.id, t2.local_authority FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id GROUP BY t1.station_id HAVING MAX(t1.precipitation) > 50
show the lowest low temperature and highest wind speed in miles per hour.
Additional table information: table: station_weather
SQL: SELECT MIN(low_temperature), MAX(wind_speed_mph) FROM weekly_weather
Find the origins from which more than 1 train starts.
Additional table information: table: station_weather
SQL: SELECT origin FROM train GROUP BY origin HAVING COUNT(*) > 1
Find the number of professors in accounting department.
Additional table information: table: college_1
SQL: SELECT COUNT(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE DEPT_NAME = 'Accounting'
How many professors are in the accounting dept?
Additional table information: table: college_1
SQL: SELECT COUNT(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE DEPT_NAME = 'Accounting'
How many professors are teaching class with code ACCT-211?
Additional table information: table: college_1
SQL: SELECT COUNT(DISTINCT PROF_NUM) FROM CLASS WHERE CRS_CODE = 'ACCT-211'
How many professors teach a class with the code ACCT-211?
Additional table information: table: college_1
SQL: SELECT COUNT(DISTINCT PROF_NUM) FROM CLASS WHERE CRS_CODE = 'ACCT-211'
What is the first and last name of the professor in biology department?
Additional table information: table: college_1
SQL: SELECT T3.EMP_FNAME, T3.EMP_LNAME FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code JOIN employee AS T3 ON T1.EMP_NUM = T3.EMP_NUM WHERE DEPT_NAME = 'Biology'
What are the first and last name of all biology professors?
Additional table information: table: college_1
SQL: SELECT T3.EMP_FNAME, T3.EMP_LNAME FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code JOIN employee AS T3 ON T1.EMP_NUM = T3.EMP_NUM WHERE DEPT_NAME = 'Biology'
What are the first names and date of birth of professors teaching course ACCT-211?
Additional table information: table: college_1
SQL: SELECT DISTINCT T1.EMP_FNAME, T1.EMP_DOB FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE CRS_CODE = 'ACCT-211'
What are the first names and birthdates of the professors in charge of ACCT-211?
Additional table information: table: college_1
SQL: SELECT DISTINCT T1.EMP_FNAME, T1.EMP_DOB FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE CRS_CODE = 'ACCT-211'
How many classes are professor whose last name is Graztevski has?
Additional table information: table: college_1
SQL: SELECT COUNT(*) FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE T1.EMP_LNAME = 'Graztevski'
How many classes does the professor whose last name is Graztevski teach?
Additional table information: table: college_1
SQL: SELECT COUNT(*) FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE T1.EMP_LNAME = 'Graztevski'
What is the code of the school where the accounting department belongs to?
Additional table information: table: college_1
SQL: SELECT school_code FROM department WHERE dept_name = 'Accounting'
What is the school code of the accounting department?
Additional table information: table: college_1
SQL: SELECT school_code FROM department WHERE dept_name = 'Accounting'
How many credits does course CIS-220 have, and what its description?
Additional table information: table: college_1
SQL: SELECT crs_credit, crs_description FROM course WHERE crs_code = 'CIS-220'
What is the description for the CIS-220 and how many credits does it have?
Additional table information: table: college_1
SQL: SELECT crs_credit, crs_description FROM course WHERE crs_code = 'CIS-220'
what is the address of history department?
Additional table information: table: college_1
SQL: SELECT dept_address FROM department WHERE dept_name = 'History'
Where is the history department?
Additional table information: table: college_1
SQL: SELECT dept_address FROM department WHERE dept_name = 'History'
How many different locations does the school with code BUS has?
Additional table information: table: college_1
SQL: SELECT COUNT(DISTINCT dept_address) FROM department WHERE school_code = 'BUS'
What are the different locations of the school with the code BUS?
Additional table information: table: college_1
SQL: SELECT COUNT(DISTINCT dept_address) FROM department WHERE school_code = 'BUS'
How many different locations does each school have?
Additional table information: table: college_1
SQL: SELECT COUNT(DISTINCT dept_address), school_code FROM department GROUP BY school_code
Count different addresses of each school.
Additional table information: table: college_1
SQL: SELECT COUNT(DISTINCT dept_address), school_code FROM department GROUP BY school_code
Find the description and credit for the course QM-261?
Additional table information: table: college_1
SQL: SELECT crs_credit, crs_description FROM course WHERE crs_code = 'QM-261'
What is the course description and number of credits for QM-261?
Additional table information: table: college_1
SQL: SELECT crs_credit, crs_description FROM course WHERE crs_code = 'QM-261'
Find the number of departments in each school.
Additional table information: table: college_1
SQL: SELECT COUNT(DISTINCT dept_name), school_code FROM department GROUP BY school_code
How many departments are in each school?
Additional table information: table: college_1
SQL: SELECT COUNT(DISTINCT dept_name), school_code FROM department GROUP BY school_code
Find the number of different departments in each school whose number of different departments is less than 5.
Additional table information: table: college_1
SQL: SELECT COUNT(DISTINCT dept_name), school_code FROM department GROUP BY school_code HAVING COUNT(DISTINCT dept_name) < 5
How many different departments are there in each school that has less than 5 apartments?
Additional table information: table: college_1
SQL: SELECT COUNT(DISTINCT dept_name), school_code FROM department GROUP BY school_code HAVING COUNT(DISTINCT dept_name) < 5
How many sections does each course has?
Additional table information: table: college_1
SQL: SELECT COUNT(*), crs_code FROM CLASS GROUP BY crs_code
How many sections does each course have?
Additional table information: table: college_1
SQL: SELECT COUNT(*), crs_code FROM CLASS GROUP BY crs_code
What is the total credit does each department offer?
Additional table information: table: college_1
SQL: SELECT SUM(crs_credit), dept_code FROM course GROUP BY dept_code
How many credits does the department offer?
Additional table information: table: college_1
SQL: SELECT SUM(crs_credit), dept_code FROM course GROUP BY dept_code
Find the number of classes offered for all class rooms that held at least 2 classes.
Additional table information: table: college_1
SQL: SELECT COUNT(*), class_room FROM CLASS GROUP BY class_room HAVING COUNT(*) >= 2
For each classroom with at least 2 classes, how many classes are offered?
Additional table information: table: college_1
SQL: SELECT COUNT(*), class_room FROM CLASS GROUP BY class_room HAVING COUNT(*) >= 2
Find the number of classes in each department.
Additional table information: table: college_1
SQL: SELECT COUNT(*), dept_code FROM CLASS AS T1 JOIN course AS T2 ON T1.crs_code = T2.crs_code GROUP BY dept_code
How many classes are held in each department?
Additional table information: table: college_1
SQL: SELECT COUNT(*), dept_code FROM CLASS AS T1 JOIN course AS T2 ON T1.crs_code = T2.crs_code GROUP BY dept_code