answer
stringlengths
18
557
context
stringlengths
27
489
question
stringlengths
12
244
text
stringlengths
275
1.7k
SELECT SUM(amount), T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname
CREATE TABLE loan (branch_id VARCHAR); CREATE TABLE bank (bname VARCHAR, branch_id VARCHAR)
Find the total amount of loans offered by each bank branch.
<s>[INST] Given the following SQL query and context: Query: SELECT SUM(amount), T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname Context: CREATE TABLE loan (branch_id VARCHAR); CREATE TABLE bank (bname VARCHAR, branch_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the total amount of loans offered by each bank branch. The answer to your question is: SELECT SUM(amount), T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname. [/s>
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
CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR); CREATE TABLE loan (cust_id VARCHAR)
Find the name of customers who have more than one loan.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR); CREATE TABLE loan (cust_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the name of customers who have more than one loan. The answer to your question is: 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. [/s>
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
CREATE TABLE loan (cust_id VARCHAR, amount INTEGER); CREATE TABLE customer (cust_name VARCHAR, acc_type VARCHAR, cust_id VARCHAR)
Find the name and account balance of the customers who have loans with a total amount of more than 5000.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE loan (cust_id VARCHAR, amount INTEGER); CREATE TABLE customer (cust_name VARCHAR, acc_type VARCHAR, cust_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the name and account balance of the customers who have loans with a total amount of more than 5000. The answer to your question is: 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. [/s>
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
CREATE TABLE loan (branch_id VARCHAR, amount INTEGER); CREATE TABLE bank (bname VARCHAR, branch_id VARCHAR)
Find the name of bank branch that provided the greatest total amount of loans.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE loan (branch_id VARCHAR, amount INTEGER); CREATE TABLE bank (bname VARCHAR, branch_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the name of bank branch that provided the greatest total amount of loans. The answer to your question is: 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. [/s>
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
CREATE TABLE loan (branch_id VARCHAR, cust_id VARCHAR, amount INTEGER); CREATE TABLE bank (bname VARCHAR, branch_id VARCHAR); CREATE TABLE customer (cust_id VARCHAR, credit_score INTEGER)
Find the name of bank branch that provided the greatest total amount of loans to customers with credit score is less than 100.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE loan (branch_id VARCHAR, cust_id VARCHAR, amount INTEGER); CREATE TABLE bank (bname VARCHAR, branch_id VARCHAR); CREATE TABLE customer (cust_id VARCHAR, credit_score INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the name of bank branch that provided the greatest total amount of loans to customers with credit score is less than 100. The answer to your question is: 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. [/s>
SELECT DISTINCT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id
CREATE TABLE loan (branch_id VARCHAR); CREATE TABLE bank (bname VARCHAR, branch_id VARCHAR)
Find the name of bank branches that provided some loans.
<s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id Context: CREATE TABLE loan (branch_id VARCHAR); CREATE TABLE bank (bname VARCHAR, branch_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the name of bank branches that provided some loans. The answer to your question is: SELECT DISTINCT T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id. [/s>
SELECT DISTINCT T1.cust_name, T1.credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id
CREATE TABLE customer (cust_name VARCHAR, credit_score VARCHAR, cust_id VARCHAR); CREATE TABLE loan (cust_id VARCHAR)
Find the name and credit score of the customers who have some loans.
<s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT T1.cust_name, T1.credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id Context: CREATE TABLE customer (cust_name VARCHAR, credit_score VARCHAR, cust_id VARCHAR); CREATE TABLE loan (cust_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the name and credit score of the customers who have some loans. The answer to your question is: SELECT DISTINCT T1.cust_name, T1.credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id. [/s>
SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE amount > 3000
CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR); CREATE TABLE loan (cust_id VARCHAR)
Find the the name of the customers who have a loan with amount more than 3000.
<s>[INST] Given the following SQL query and context: Query: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE amount > 3000 Context: CREATE TABLE customer (cust_name VARCHAR, cust_id VARCHAR); CREATE TABLE loan (cust_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the the name of the customers who have a loan with amount more than 3000. The answer to your question is: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE amount > 3000. [/s>
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'
CREATE TABLE bank (bname VARCHAR, city VARCHAR, branch_id VARCHAR); CREATE TABLE loan (branch_id VARCHAR, loan_type VARCHAR)
Find the city and name of bank branches that provide business loans.
<s>[INST] Given the following SQL query and context: Query: 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' Context: CREATE TABLE bank (bname VARCHAR, city VARCHAR, branch_id VARCHAR); CREATE TABLE loan (branch_id VARCHAR, loan_type VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the city and name of bank branches that provide business loans. The answer to your question is: 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'. [/s>
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
CREATE TABLE bank (bname VARCHAR, branch_id VARCHAR); CREATE TABLE customer (cust_id VARCHAR, credit_score INTEGER); CREATE TABLE loan (branch_id VARCHAR, cust_id VARCHAR)
Find the names of bank branches that have provided a loan to any customer whose credit score is below 100.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE bank (bname VARCHAR, branch_id VARCHAR); CREATE TABLE customer (cust_id VARCHAR, credit_score INTEGER); CREATE TABLE loan (branch_id VARCHAR, cust_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the names of bank branches that have provided a loan to any customer whose credit score is below 100. The answer to your question is: 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. [/s>
SELECT SUM(T2.amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id WHERE T1.state = 'New York'
CREATE TABLE bank (branch_id VARCHAR, state VARCHAR); CREATE TABLE loan (amount INTEGER, branch_id VARCHAR)
Find the total amount of loans provided by bank branches in the state of New York.
<s>[INST] Given the following SQL query and context: Query: SELECT SUM(T2.amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id WHERE T1.state = 'New York' Context: CREATE TABLE bank (branch_id VARCHAR, state VARCHAR); CREATE TABLE loan (amount INTEGER, branch_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the total amount of loans provided by bank branches in the state of New York. The answer to your question is: SELECT SUM(T2.amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id WHERE T1.state = 'New York'. [/s>
SELECT AVG(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan)
CREATE TABLE loan (credit_score INTEGER, cust_id VARCHAR); CREATE TABLE customer (credit_score INTEGER, cust_id VARCHAR)
Find the average credit score of the customers who have some loan.
<s>[INST] Given the following SQL query and context: Query: SELECT AVG(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan) Context: CREATE TABLE loan (credit_score INTEGER, cust_id VARCHAR); CREATE TABLE customer (credit_score INTEGER, cust_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the average credit score of the customers who have some loan. The answer to your question is: SELECT AVG(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan). [/s>
SELECT AVG(credit_score) FROM customer WHERE NOT cust_id IN (SELECT cust_id FROM loan)
CREATE TABLE loan (credit_score INTEGER, cust_id VARCHAR); CREATE TABLE customer (credit_score INTEGER, cust_id VARCHAR)
Find the average credit score of the customers who do not have any loan.
<s>[INST] Given the following SQL query and context: Query: SELECT AVG(credit_score) FROM customer WHERE NOT cust_id IN (SELECT cust_id FROM loan) Context: CREATE TABLE loan (credit_score INTEGER, cust_id VARCHAR); CREATE TABLE customer (credit_score INTEGER, cust_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the average credit score of the customers who do not have any loan. The answer to your question is: SELECT AVG(credit_score) FROM customer WHERE NOT cust_id IN (SELECT cust_id FROM loan). [/s>
SELECT COUNT(*) FROM ASSESSMENT_NOTES
CREATE TABLE ASSESSMENT_NOTES (Id VARCHAR)
How many assessment notes are there in total?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM ASSESSMENT_NOTES Context: CREATE TABLE ASSESSMENT_NOTES (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many assessment notes are there in total? The answer to your question is: SELECT COUNT(*) FROM ASSESSMENT_NOTES. [/s>
SELECT date_of_notes FROM Assessment_Notes
CREATE TABLE Assessment_Notes (date_of_notes VARCHAR)
What are the dates of the assessment notes?
<s>[INST] Given the following SQL query and context: Query: SELECT date_of_notes FROM Assessment_Notes Context: CREATE TABLE Assessment_Notes (date_of_notes VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the dates of the assessment notes? The answer to your question is: SELECT date_of_notes FROM Assessment_Notes. [/s>
SELECT COUNT(*) FROM ADDRESSES WHERE zip_postcode = "197"
CREATE TABLE ADDRESSES (zip_postcode VARCHAR)
How many addresses have zip code 197?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM ADDRESSES WHERE zip_postcode = "197" Context: CREATE TABLE ADDRESSES (zip_postcode VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many addresses have zip code 197? The answer to your question is: SELECT COUNT(*) FROM ADDRESSES WHERE zip_postcode = "197". [/s>
SELECT COUNT(DISTINCT incident_type_code) FROM Behavior_Incident
CREATE TABLE Behavior_Incident (incident_type_code VARCHAR)
How many distinct incident type codes are there?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(DISTINCT incident_type_code) FROM Behavior_Incident Context: CREATE TABLE Behavior_Incident (incident_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many distinct incident type codes are there? The answer to your question is: SELECT COUNT(DISTINCT incident_type_code) FROM Behavior_Incident. [/s>
SELECT DISTINCT detention_type_code FROM Detention
CREATE TABLE Detention (detention_type_code VARCHAR)
Return all distinct detention type codes.
<s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT detention_type_code FROM Detention Context: CREATE TABLE Detention (detention_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Return all distinct detention type codes. The answer to your question is: SELECT DISTINCT detention_type_code FROM Detention. [/s>
SELECT date_incident_start, date_incident_end FROM Behavior_Incident WHERE incident_type_code = "NOISE"
CREATE TABLE Behavior_Incident (date_incident_start VARCHAR, date_incident_end VARCHAR, incident_type_code VARCHAR)
What are the start and end dates for incidents with incident type code "NOISE"?
<s>[INST] Given the following SQL query and context: Query: SELECT date_incident_start, date_incident_end FROM Behavior_Incident WHERE incident_type_code = "NOISE" Context: CREATE TABLE Behavior_Incident (date_incident_start VARCHAR, date_incident_end VARCHAR, incident_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the start and end dates for incidents with incident type code "NOISE"? The answer to your question is: SELECT date_incident_start, date_incident_end FROM Behavior_Incident WHERE incident_type_code = "NOISE". [/s>
SELECT detention_summary FROM Detention
CREATE TABLE Detention (detention_summary VARCHAR)
Return all detention summaries.
<s>[INST] Given the following SQL query and context: Query: SELECT detention_summary FROM Detention Context: CREATE TABLE Detention (detention_summary VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Return all detention summaries. The answer to your question is: SELECT detention_summary FROM Detention. [/s>
SELECT cell_mobile_number, email_address FROM STUDENTS
CREATE TABLE STUDENTS (cell_mobile_number VARCHAR, email_address VARCHAR)
Return the cell phone number and email address for all students.
<s>[INST] Given the following SQL query and context: Query: SELECT cell_mobile_number, email_address FROM STUDENTS Context: CREATE TABLE STUDENTS (cell_mobile_number VARCHAR, email_address VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Return the cell phone number and email address for all students. The answer to your question is: SELECT cell_mobile_number, email_address FROM STUDENTS. [/s>
SELECT email_address FROM Students WHERE first_name = "Emma" AND last_name = "Rohan"
CREATE TABLE Students (email_address VARCHAR, first_name VARCHAR, last_name VARCHAR)
What is the email of the student with first name "Emma" and last name "Rohan"?
<s>[INST] Given the following SQL query and context: Query: SELECT email_address FROM Students WHERE first_name = "Emma" AND last_name = "Rohan" Context: CREATE TABLE Students (email_address VARCHAR, first_name VARCHAR, last_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the email of the student with first name "Emma" and last name "Rohan"? The answer to your question is: SELECT email_address FROM Students WHERE first_name = "Emma" AND last_name = "Rohan". [/s>
SELECT COUNT(DISTINCT student_id) FROM Students_in_Detention
CREATE TABLE Students_in_Detention (student_id VARCHAR)
How many distinct students have been in detention?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(DISTINCT student_id) FROM Students_in_Detention Context: CREATE TABLE Students_in_Detention (student_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many distinct students have been in detention? The answer to your question is: SELECT COUNT(DISTINCT student_id) FROM Students_in_Detention. [/s>
SELECT gender FROM TEACHERS WHERE last_name = "Medhurst"
CREATE TABLE TEACHERS (gender VARCHAR, last_name VARCHAR)
What is the gender of the teacher with last name "Medhurst"?
<s>[INST] Given the following SQL query and context: Query: SELECT gender FROM TEACHERS WHERE last_name = "Medhurst" Context: CREATE TABLE TEACHERS (gender VARCHAR, last_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the gender of the teacher with last name "Medhurst"? The answer to your question is: SELECT gender FROM TEACHERS WHERE last_name = "Medhurst". [/s>
SELECT incident_type_description FROM Ref_Incident_Type WHERE incident_type_code = "VIOLENCE"
CREATE TABLE Ref_Incident_Type (incident_type_description VARCHAR, incident_type_code VARCHAR)
What is the incident type description for the incident type with code "VIOLENCE"?
<s>[INST] Given the following SQL query and context: Query: SELECT incident_type_description FROM Ref_Incident_Type WHERE incident_type_code = "VIOLENCE" Context: CREATE TABLE Ref_Incident_Type (incident_type_description VARCHAR, incident_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the incident type description for the incident type with code "VIOLENCE"? The answer to your question is: SELECT incident_type_description FROM Ref_Incident_Type WHERE incident_type_code = "VIOLENCE". [/s>
SELECT MAX(monthly_rental), MIN(monthly_rental) FROM Student_Addresses
CREATE TABLE Student_Addresses (monthly_rental INTEGER)
Find the maximum and minimum monthly rental for all student addresses.
<s>[INST] Given the following SQL query and context: Query: SELECT MAX(monthly_rental), MIN(monthly_rental) FROM Student_Addresses Context: CREATE TABLE Student_Addresses (monthly_rental INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the maximum and minimum monthly rental for all student addresses. The answer to your question is: SELECT MAX(monthly_rental), MIN(monthly_rental) FROM Student_Addresses. [/s>
SELECT first_name FROM Teachers WHERE email_address LIKE '%man%'
CREATE TABLE Teachers (first_name VARCHAR, email_address VARCHAR)
Find the first names of teachers whose email address contains the word "man".
<s>[INST] Given the following SQL query and context: Query: SELECT first_name FROM Teachers WHERE email_address LIKE '%man%' Context: CREATE TABLE Teachers (first_name VARCHAR, email_address VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the first names of teachers whose email address contains the word "man". The answer to your question is: SELECT first_name FROM Teachers WHERE email_address LIKE '%man%'. [/s>
SELECT * FROM Assessment_Notes ORDER BY date_of_notes
CREATE TABLE Assessment_Notes (date_of_notes VARCHAR)
List all information about the assessment notes sorted by date in ascending order.
<s>[INST] Given the following SQL query and context: Query: SELECT * FROM Assessment_Notes ORDER BY date_of_notes Context: CREATE TABLE Assessment_Notes (date_of_notes VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List all information about the assessment notes sorted by date in ascending order. The answer to your question is: SELECT * FROM Assessment_Notes ORDER BY date_of_notes. [/s>
SELECT city FROM Addresses ORDER BY city
CREATE TABLE Addresses (city VARCHAR)
List all cities of addresses in alphabetical order.
<s>[INST] Given the following SQL query and context: Query: SELECT city FROM Addresses ORDER BY city Context: CREATE TABLE Addresses (city VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List all cities of addresses in alphabetical order. The answer to your question is: SELECT city FROM Addresses ORDER BY city. [/s>
SELECT first_name, last_name FROM Teachers ORDER BY last_name
CREATE TABLE Teachers (first_name VARCHAR, last_name VARCHAR)
Find the first names and last names of teachers in alphabetical order of last name.
<s>[INST] Given the following SQL query and context: Query: SELECT first_name, last_name FROM Teachers ORDER BY last_name Context: CREATE TABLE Teachers (first_name VARCHAR, last_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the first names and last names of teachers in alphabetical order of last name. The answer to your question is: SELECT first_name, last_name FROM Teachers ORDER BY last_name. [/s>
SELECT * FROM Student_Addresses ORDER BY monthly_rental DESC
CREATE TABLE Student_Addresses (monthly_rental VARCHAR)
Find all information about student addresses, and sort by monthly rental in descending order.
<s>[INST] Given the following SQL query and context: Query: SELECT * FROM Student_Addresses ORDER BY monthly_rental DESC Context: CREATE TABLE Student_Addresses (monthly_rental VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find all information about student addresses, and sort by monthly rental in descending order. The answer to your question is: SELECT * FROM Student_Addresses ORDER BY monthly_rental DESC. [/s>
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
CREATE TABLE Students (first_name VARCHAR, student_id VARCHAR); CREATE TABLE Assessment_Notes (student_id VARCHAR)
Find the id and first name of the student that has the most number of assessment notes?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Students (first_name VARCHAR, student_id VARCHAR); CREATE TABLE Assessment_Notes (student_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the id and first name of the student that has the most number of assessment notes? The answer to your question is: 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. [/s>
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
CREATE TABLE Assessment_Notes (teacher_id VARCHAR); CREATE TABLE Teachers (first_name VARCHAR, teacher_id VARCHAR)
Find the ids and first names of the 3 teachers that have the most number of assessment notes?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Assessment_Notes (teacher_id VARCHAR); CREATE TABLE Teachers (first_name VARCHAR, teacher_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the ids and first names of the 3 teachers that have the most number of assessment notes? The answer to your question is: 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. [/s>
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
CREATE TABLE Students (last_name VARCHAR, student_id VARCHAR); CREATE TABLE Behavior_Incident (student_id VARCHAR)
Find the id and last name of the student that has the most behavior incidents?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Students (last_name VARCHAR, student_id VARCHAR); CREATE TABLE Behavior_Incident (student_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the id and last name of the student that has the most behavior incidents? The answer to your question is: 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. [/s>
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
CREATE TABLE Detention (teacher_id VARCHAR, detention_type_code VARCHAR); CREATE TABLE Teachers (last_name VARCHAR, teacher_id VARCHAR)
Find the id and last name of the teacher that has the most detentions with detention type code "AFTER"?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Detention (teacher_id VARCHAR, detention_type_code VARCHAR); CREATE TABLE Teachers (last_name VARCHAR, teacher_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the id and last name of the teacher that has the most detentions with detention type code "AFTER"? The answer to your question is: 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. [/s>
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
CREATE TABLE Students (first_name VARCHAR, student_id VARCHAR); CREATE TABLE Student_Addresses (student_id VARCHAR)
What are the id and first name of the student whose addresses have the highest average monthly rental?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Students (first_name VARCHAR, student_id VARCHAR); CREATE TABLE Student_Addresses (student_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the id and first name of the student whose addresses have the highest average monthly rental? The answer to your question is: 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. [/s>
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
CREATE TABLE Student_Addresses (address_id VARCHAR); CREATE TABLE Addresses (city VARCHAR, address_id VARCHAR)
Find the id and city of the student address with the highest average monthly rental.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Student_Addresses (address_id VARCHAR); CREATE TABLE Addresses (city VARCHAR, address_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the id and city of the student address with the highest average monthly rental. The answer to your question is: 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. [/s>
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
CREATE TABLE Ref_Incident_Type (incident_type_description VARCHAR, incident_type_code VARCHAR); CREATE TABLE Behavior_Incident (incident_type_code VARCHAR)
What are the code and description of the most frequent behavior incident type?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Ref_Incident_Type (incident_type_description VARCHAR, incident_type_code VARCHAR); CREATE TABLE Behavior_Incident (incident_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the code and description of the most frequent behavior incident type? The answer to your question is: 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. [/s>
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(*) LIMIT 1
CREATE TABLE Ref_Detention_Type (detention_type_description VARCHAR, detention_type_code VARCHAR); CREATE TABLE Detention (detention_type_code VARCHAR)
What are the code and description of the least frequent detention type ?
<s>[INST] Given the following SQL query and context: Query: 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(*) LIMIT 1 Context: CREATE TABLE Ref_Detention_Type (detention_type_description VARCHAR, detention_type_code VARCHAR); CREATE TABLE Detention (detention_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the code and description of the least frequent detention type ? The answer to your question is: 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(*) LIMIT 1. [/s>
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"
CREATE TABLE Students (student_id VARCHAR, first_name VARCHAR); CREATE TABLE Assessment_Notes (date_of_notes VARCHAR, student_id VARCHAR)
Find the dates of assessment notes for students with first name "Fanny".
<s>[INST] Given the following SQL query and context: Query: 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" Context: CREATE TABLE Students (student_id VARCHAR, first_name VARCHAR); CREATE TABLE Assessment_Notes (date_of_notes VARCHAR, student_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the dates of assessment notes for students with first name "Fanny". The answer to your question is: 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". [/s>
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"
CREATE TABLE Assessment_Notes (text_of_notes VARCHAR, teacher_id VARCHAR); CREATE TABLE Teachers (teacher_id VARCHAR, last_name VARCHAR)
Find the texts of assessment notes for teachers with last name "Schuster".
<s>[INST] Given the following SQL query and context: Query: 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" Context: CREATE TABLE Assessment_Notes (text_of_notes VARCHAR, teacher_id VARCHAR); CREATE TABLE Teachers (teacher_id VARCHAR, last_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the texts of assessment notes for teachers with last name "Schuster". The answer to your question is: 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". [/s>
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"
CREATE TABLE Behavior_Incident (date_incident_start VARCHAR, student_id VARCHAR); CREATE TABLE Students (student_id VARCHAR, last_name VARCHAR)
Find the start and end dates of behavior incidents of students with last name "Fahey".
<s>[INST] Given the following SQL query and context: Query: 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" Context: CREATE TABLE Behavior_Incident (date_incident_start VARCHAR, student_id VARCHAR); CREATE TABLE Students (student_id VARCHAR, last_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the start and end dates of behavior incidents of students with last name "Fahey". The answer to your question is: 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". [/s>
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"
CREATE TABLE Detention (datetime_detention_start VARCHAR, teacher_id VARCHAR); CREATE TABLE Teachers (teacher_id VARCHAR, last_name VARCHAR)
Find the start and end dates of detentions of teachers with last name "Schultz".
<s>[INST] Given the following SQL query and context: Query: 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" Context: CREATE TABLE Detention (datetime_detention_start VARCHAR, teacher_id VARCHAR); CREATE TABLE Teachers (teacher_id VARCHAR, last_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the start and end dates of detentions of teachers with last name "Schultz". The answer to your question is: 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". [/s>
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
CREATE TABLE Student_Addresses (address_id VARCHAR); CREATE TABLE Addresses (zip_postcode VARCHAR, address_id VARCHAR)
What are the id and zip code of the address with the highest monthly rental?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Student_Addresses (address_id VARCHAR); CREATE TABLE Addresses (zip_postcode VARCHAR, address_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the id and zip code of the address with the highest monthly rental? The answer to your question is: 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. [/s>
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 LIMIT 1
CREATE TABLE Students (cell_mobile_number VARCHAR, student_id VARCHAR); CREATE TABLE Student_Addresses (student_id VARCHAR, monthly_rental VARCHAR)
What is the cell phone number of the student whose address has the lowest monthly rental?
<s>[INST] Given the following SQL query and context: Query: 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 LIMIT 1 Context: CREATE TABLE Students (cell_mobile_number VARCHAR, student_id VARCHAR); CREATE TABLE Student_Addresses (student_id VARCHAR, monthly_rental VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the cell phone number of the student whose address has the lowest monthly rental? The answer to your question is: 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 LIMIT 1. [/s>
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"
CREATE TABLE Addresses (address_id VARCHAR, state_province_county VARCHAR); CREATE TABLE Student_Addresses (monthly_rental VARCHAR, address_id VARCHAR)
What are the monthly rentals of student addresses in Texas state?
<s>[INST] Given the following SQL query and context: Query: 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" Context: CREATE TABLE Addresses (address_id VARCHAR, state_province_county VARCHAR); CREATE TABLE Student_Addresses (monthly_rental VARCHAR, address_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the monthly rentals of student addresses in Texas state? The answer to your question is: 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". [/s>
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"
CREATE TABLE Addresses (address_id VARCHAR, state_province_county VARCHAR); CREATE TABLE Students (first_name VARCHAR, last_name VARCHAR, address_id VARCHAR)
What are the first names and last names of students with address in Wisconsin state?
<s>[INST] Given the following SQL query and context: Query: 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" Context: CREATE TABLE Addresses (address_id VARCHAR, state_province_county VARCHAR); CREATE TABLE Students (first_name VARCHAR, last_name VARCHAR, address_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the first names and last names of students with address in Wisconsin state? The answer to your question is: 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". [/s>
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
CREATE TABLE Addresses (line_1 VARCHAR, address_id VARCHAR); CREATE TABLE Student_Addresses (monthly_rental INTEGER, address_id VARCHAR)
What are the line 1 and average monthly rentals of all student addresses?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Addresses (line_1 VARCHAR, address_id VARCHAR); CREATE TABLE Student_Addresses (monthly_rental INTEGER, address_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the line 1 and average monthly rentals of all student addresses? The answer to your question is: 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. [/s>
SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = "Lyla"
CREATE TABLE Teachers (address_id VARCHAR, first_name VARCHAR); CREATE TABLE Addresses (zip_postcode VARCHAR, address_id VARCHAR)
What is the zip code of the address where the teacher with first name "Lyla" lives?
<s>[INST] Given the following SQL query and context: Query: SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = "Lyla" Context: CREATE TABLE Teachers (address_id VARCHAR, first_name VARCHAR); CREATE TABLE Addresses (zip_postcode VARCHAR, address_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the zip code of the address where the teacher with first name "Lyla" lives? The answer to your question is: SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = "Lyla". [/s>
SELECT T2.email_address FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T1.zip_postcode = "918"
CREATE TABLE Addresses (address_id VARCHAR, zip_postcode VARCHAR); CREATE TABLE Teachers (email_address VARCHAR, address_id VARCHAR)
What are the email addresses of teachers whose address has zip code "918"?
<s>[INST] Given the following SQL query and context: Query: SELECT T2.email_address FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T1.zip_postcode = "918" Context: CREATE TABLE Addresses (address_id VARCHAR, zip_postcode VARCHAR); CREATE TABLE Teachers (email_address VARCHAR, address_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the email addresses of teachers whose address has zip code "918"? The answer to your question is: SELECT T2.email_address FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T1.zip_postcode = "918". [/s>
SELECT COUNT(*) FROM STUDENTS WHERE NOT student_id IN (SELECT student_id FROM Behavior_Incident)
CREATE TABLE STUDENTS (student_id VARCHAR); CREATE TABLE Behavior_Incident (student_id VARCHAR)
How many students are not involved in any behavior incident?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM STUDENTS WHERE NOT student_id IN (SELECT student_id FROM Behavior_Incident) Context: CREATE TABLE STUDENTS (student_id VARCHAR); CREATE TABLE Behavior_Incident (student_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many students are not involved in any behavior incident? The answer to your question is: SELECT COUNT(*) FROM STUDENTS WHERE NOT student_id IN (SELECT student_id FROM Behavior_Incident). [/s>
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
CREATE TABLE Teachers (last_name VARCHAR); CREATE TABLE Teachers (last_name VARCHAR, teacher_id VARCHAR); CREATE TABLE Detention (teacher_id VARCHAR)
Find the last names of teachers who are not involved in any detention.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Teachers (last_name VARCHAR); CREATE TABLE Teachers (last_name VARCHAR, teacher_id VARCHAR); CREATE TABLE Detention (teacher_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the last names of teachers who are not involved in any detention. The answer to your question is: 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. [/s>
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
CREATE TABLE Teachers (address_id VARCHAR); CREATE TABLE Students (address_id VARCHAR); CREATE TABLE Addresses (line_1 VARCHAR, address_id VARCHAR)
What are the line 1 of addresses shared by some students and some teachers?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Teachers (address_id VARCHAR); CREATE TABLE Students (address_id VARCHAR); CREATE TABLE Addresses (line_1 VARCHAR, address_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the line 1 of addresses shared by some students and some teachers? The answer to your question is: 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. [/s>
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
CREATE TABLE Assets (asset_id VARCHAR, asset_details VARCHAR); CREATE TABLE Asset_Parts (asset_id VARCHAR); CREATE TABLE Fault_Log (asset_id VARCHAR)
Which assets have 2 parts and have less than 2 fault logs? List the asset id and detail.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Assets (asset_id VARCHAR, asset_details VARCHAR); CREATE TABLE Asset_Parts (asset_id VARCHAR); CREATE TABLE Fault_Log (asset_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which assets have 2 parts and have less than 2 fault logs? List the asset id and detail. The answer to your question is: 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. [/s>
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
CREATE TABLE Assets (maintenance_contract_id VARCHAR); CREATE TABLE Maintenance_Contracts (maintenance_contract_id VARCHAR)
How many assets does each maintenance contract contain? List the number and the contract id.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Assets (maintenance_contract_id VARCHAR); CREATE TABLE Maintenance_Contracts (maintenance_contract_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many assets does each maintenance contract contain? List the number and the contract id. The answer to your question is: 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. [/s>
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
CREATE TABLE Assets (supplier_company_id VARCHAR); CREATE TABLE Third_Party_Companies (company_id VARCHAR)
How many assets does each third party company supply? List the count and the company id.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Assets (supplier_company_id VARCHAR); CREATE TABLE Third_Party_Companies (company_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many assets does each third party company supply? List the count and the company id. The answer to your question is: 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. [/s>
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
CREATE TABLE Maintenance_Contracts (maintenance_contract_company_id VARCHAR); CREATE TABLE Maintenance_Engineers (company_id VARCHAR); CREATE TABLE Third_Party_Companies (company_id VARCHAR, company_name VARCHAR)
Which third party companies have at least 2 maintenance engineers or have at least 2 maintenance contracts? List the company id and name.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Maintenance_Contracts (maintenance_contract_company_id VARCHAR); CREATE TABLE Maintenance_Engineers (company_id VARCHAR); CREATE TABLE Third_Party_Companies (company_id VARCHAR, company_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which third party companies have at least 2 maintenance engineers or have at least 2 maintenance contracts? List the company id and name. The answer to your question is: 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. [/s>
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
CREATE TABLE Engineer_Visits (contact_staff_id VARCHAR); CREATE TABLE Staff (staff_name VARCHAR, staff_id VARCHAR); CREATE TABLE Fault_Log (recorded_by_staff_id VARCHAR)
What is the name and id of the staff who recorded the fault log but has not contacted any visiting engineers?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Engineer_Visits (contact_staff_id VARCHAR); CREATE TABLE Staff (staff_name VARCHAR, staff_id VARCHAR); CREATE TABLE Fault_Log (recorded_by_staff_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the name and id of the staff who recorded the fault log but has not contacted any visiting engineers? The answer to your question is: 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. [/s>
SELECT T1.engineer_id, T1.first_name, T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 GROUP BY T1.engineer_id ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE Maintenance_Engineers (engineer_id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE Engineer_Visits (Id VARCHAR)
Which engineer has visited the most times? Show the engineer id, first name and last name.
<s>[INST] Given the following SQL query and context: Query: SELECT T1.engineer_id, T1.first_name, T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 GROUP BY T1.engineer_id ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE Maintenance_Engineers (engineer_id VARCHAR, first_name VARCHAR, last_name VARCHAR); CREATE TABLE Engineer_Visits (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which engineer has visited the most times? Show the engineer id, first name and last name. The answer to your question is: SELECT T1.engineer_id, T1.first_name, T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 GROUP BY T1.engineer_id ORDER BY COUNT(*) DESC LIMIT 1. [/s>
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
CREATE TABLE Parts (part_name VARCHAR, part_id VARCHAR); CREATE TABLE Part_Faults (part_id VARCHAR)
Which parts have more than 2 faults? Show the part name and id.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Parts (part_name VARCHAR, part_id VARCHAR); CREATE TABLE Part_Faults (part_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which parts have more than 2 faults? Show the part name and id. The answer to your question is: 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. [/s>
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
CREATE TABLE Maintenance_Engineers (first_name VARCHAR, last_name VARCHAR, other_details VARCHAR, engineer_id VARCHAR); CREATE TABLE Engineer_Skills (engineer_id VARCHAR, skill_id VARCHAR); CREATE TABLE Skills (skill_description VARCHAR, skill_id VARCHAR)
List all every engineer's first name, last name, details and coresponding skill description.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Maintenance_Engineers (first_name VARCHAR, last_name VARCHAR, other_details VARCHAR, engineer_id VARCHAR); CREATE TABLE Engineer_Skills (engineer_id VARCHAR, skill_id VARCHAR); CREATE TABLE Skills (skill_description VARCHAR, skill_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List all every engineer's first name, last name, details and coresponding skill description. The answer to your question is: 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. [/s>
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
CREATE TABLE Skills_Required_To_Fix (part_fault_id VARCHAR, skill_id VARCHAR); CREATE TABLE Part_Faults (fault_short_name VARCHAR, part_fault_id VARCHAR); CREATE TABLE Skills (skill_description VARCHAR, skill_id VARCHAR)
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.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Skills_Required_To_Fix (part_fault_id VARCHAR, skill_id VARCHAR); CREATE TABLE Part_Faults (fault_short_name VARCHAR, part_fault_id VARCHAR); CREATE TABLE Skills (skill_description VARCHAR, skill_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: 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. The answer to your question is: 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. [/s>
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
CREATE TABLE Parts (part_name VARCHAR, part_id VARCHAR); CREATE TABLE Asset_Parts (part_id VARCHAR)
How many assets can each parts be used in? List the part name and the number.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Parts (part_name VARCHAR, part_id VARCHAR); CREATE TABLE Asset_Parts (part_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many assets can each parts be used in? List the part name and the number. The answer to your question is: 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. [/s>
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
CREATE TABLE Fault_Log (fault_description VARCHAR, fault_log_entry_id VARCHAR); CREATE TABLE Fault_Log_Parts (fault_status VARCHAR, fault_log_entry_id VARCHAR)
What are all the fault descriptions and the fault status of all the faults recoreded in the logs?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Fault_Log (fault_description VARCHAR, fault_log_entry_id VARCHAR); CREATE TABLE Fault_Log_Parts (fault_status VARCHAR, fault_log_entry_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are all the fault descriptions and the fault status of all the faults recoreded in the logs? The answer to your question is: 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. [/s>
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
CREATE TABLE Fault_Log (fault_log_entry_id VARCHAR); CREATE TABLE Engineer_Visits (fault_log_entry_id VARCHAR)
How many engineer visits are required at most for a single fault log? List the number and the log entry id.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Fault_Log (fault_log_entry_id VARCHAR); CREATE TABLE Engineer_Visits (fault_log_entry_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many engineer visits are required at most for a single fault log? List the number and the log entry id. The answer to your question is: 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. [/s>
SELECT DISTINCT last_name FROM Maintenance_Engineers
CREATE TABLE Maintenance_Engineers (last_name VARCHAR)
What are all the distinct last names of all the engineers?
<s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT last_name FROM Maintenance_Engineers Context: CREATE TABLE Maintenance_Engineers (last_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are all the distinct last names of all the engineers? The answer to your question is: SELECT DISTINCT last_name FROM Maintenance_Engineers. [/s>
SELECT DISTINCT fault_status FROM Fault_Log_Parts
CREATE TABLE Fault_Log_Parts (fault_status VARCHAR)
How many fault status codes are recorded in the fault log parts table?
<s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT fault_status FROM Fault_Log_Parts Context: CREATE TABLE Fault_Log_Parts (fault_status VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many fault status codes are recorded in the fault log parts table? The answer to your question is: SELECT DISTINCT fault_status FROM Fault_Log_Parts. [/s>
SELECT first_name, last_name FROM Maintenance_Engineers WHERE NOT engineer_id IN (SELECT engineer_id FROM Engineer_Visits)
CREATE TABLE Engineer_Visits (first_name VARCHAR, last_name VARCHAR, engineer_id VARCHAR); CREATE TABLE Maintenance_Engineers (first_name VARCHAR, last_name VARCHAR, engineer_id VARCHAR)
Which engineers have never visited to maintain the assets? List the engineer first name and last name.
<s>[INST] Given the following SQL query and context: Query: SELECT first_name, last_name FROM Maintenance_Engineers WHERE NOT engineer_id IN (SELECT engineer_id FROM Engineer_Visits) Context: CREATE TABLE Engineer_Visits (first_name VARCHAR, last_name VARCHAR, engineer_id VARCHAR); CREATE TABLE Maintenance_Engineers (first_name VARCHAR, last_name VARCHAR, engineer_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which engineers have never visited to maintain the assets? List the engineer first name and last name. The answer to your question is: SELECT first_name, last_name FROM Maintenance_Engineers WHERE NOT engineer_id IN (SELECT engineer_id FROM Engineer_Visits). [/s>
SELECT asset_id, asset_details, asset_make, asset_model FROM Assets
CREATE TABLE Assets (asset_id VARCHAR, asset_details VARCHAR, asset_make VARCHAR, asset_model VARCHAR)
List the asset id, details, make and model for every asset.
<s>[INST] Given the following SQL query and context: Query: SELECT asset_id, asset_details, asset_make, asset_model FROM Assets Context: CREATE TABLE Assets (asset_id VARCHAR, asset_details VARCHAR, asset_make VARCHAR, asset_model VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List the asset id, details, make and model for every asset. The answer to your question is: SELECT asset_id, asset_details, asset_make, asset_model FROM Assets. [/s>
SELECT asset_acquired_date FROM Assets ORDER BY asset_acquired_date LIMIT 1
CREATE TABLE Assets (asset_acquired_date VARCHAR)
When was the first asset acquired?
<s>[INST] Given the following SQL query and context: Query: SELECT asset_acquired_date FROM Assets ORDER BY asset_acquired_date LIMIT 1 Context: CREATE TABLE Assets (asset_acquired_date VARCHAR) [/INST] Based on the provided SQL query and context, your question is: When was the first asset acquired? The answer to your question is: SELECT asset_acquired_date FROM Assets ORDER BY asset_acquired_date LIMIT 1. [/s>
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
CREATE TABLE Part_Faults (part_id VARCHAR, part_fault_id VARCHAR); CREATE TABLE Skills_Required_To_Fix (part_fault_id VARCHAR); CREATE TABLE Parts (part_id VARCHAR, part_name VARCHAR)
Which part fault requires the most number of skills to fix? List part id and name.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Part_Faults (part_id VARCHAR, part_fault_id VARCHAR); CREATE TABLE Skills_Required_To_Fix (part_fault_id VARCHAR); CREATE TABLE Parts (part_id VARCHAR, part_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which part fault requires the most number of skills to fix? List part id and name. The answer to your question is: 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. [/s>
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(*) LIMIT 1
CREATE TABLE Parts (part_name VARCHAR, part_id VARCHAR); CREATE TABLE Part_Faults (part_id VARCHAR)
Which kind of part has the least number of faults? List the part name.
<s>[INST] Given the following SQL query and context: Query: 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(*) LIMIT 1 Context: CREATE TABLE Parts (part_name VARCHAR, part_id VARCHAR); CREATE TABLE Part_Faults (part_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which kind of part has the least number of faults? List the part name. The answer to your question is: 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(*) LIMIT 1. [/s>
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(*) LIMIT 1
CREATE TABLE Engineer_Visits (engineer_id VARCHAR); CREATE TABLE Maintenance_Engineers (engineer_id VARCHAR, first_name VARCHAR, last_name VARCHAR)
Among those engineers who have visited, which engineer makes the least number of visits? List the engineer id, first name and last name.
<s>[INST] Given the following SQL query and context: Query: 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(*) LIMIT 1 Context: CREATE TABLE Engineer_Visits (engineer_id VARCHAR); CREATE TABLE Maintenance_Engineers (engineer_id VARCHAR, first_name VARCHAR, last_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Among those engineers who have visited, which engineer makes the least number of visits? List the engineer id, first name and last name. The answer to your question is: 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(*) LIMIT 1. [/s>
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
CREATE TABLE Engineer_Visits (contact_staff_id VARCHAR, engineer_id VARCHAR); CREATE TABLE Staff (staff_name VARCHAR, staff_id VARCHAR); CREATE TABLE Maintenance_Engineers (first_name VARCHAR, last_name VARCHAR, engineer_id VARCHAR)
Which staff have contacted which engineers? List the staff name and the engineer first name and last name.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Engineer_Visits (contact_staff_id VARCHAR, engineer_id VARCHAR); CREATE TABLE Staff (staff_name VARCHAR, staff_id VARCHAR); CREATE TABLE Maintenance_Engineers (first_name VARCHAR, last_name VARCHAR, engineer_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which staff have contacted which engineers? List the staff name and the engineer first name and last name. The answer to your question is: 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. [/s>
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
CREATE TABLE Fault_Log (fault_log_entry_id VARCHAR, fault_description VARCHAR, fault_log_entry_datetime VARCHAR); CREATE TABLE Fault_Log_Parts (fault_log_entry_id VARCHAR)
Which fault log included the most number of faulty parts? List the fault log id, description and record time.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Fault_Log (fault_log_entry_id VARCHAR, fault_description VARCHAR, fault_log_entry_datetime VARCHAR); CREATE TABLE Fault_Log_Parts (fault_log_entry_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which fault log included the most number of faulty parts? List the fault log id, description and record time. The answer to your question is: 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. [/s>
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
CREATE TABLE Skills (skill_id VARCHAR, skill_description VARCHAR); CREATE TABLE Skills_Required_To_Fix (skill_id VARCHAR)
Which skill is used in fixing the most number of faults? List the skill id and description.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Skills (skill_id VARCHAR, skill_description VARCHAR); CREATE TABLE Skills_Required_To_Fix (skill_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which skill is used in fixing the most number of faults? List the skill id and description. The answer to your question is: 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. [/s>
SELECT DISTINCT asset_model FROM Assets
CREATE TABLE Assets (asset_model VARCHAR)
What are all the distinct asset models?
<s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT asset_model FROM Assets Context: CREATE TABLE Assets (asset_model VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are all the distinct asset models? The answer to your question is: SELECT DISTINCT asset_model FROM Assets. [/s>
SELECT asset_make, asset_model, asset_details FROM Assets ORDER BY asset_disposed_date
CREATE TABLE Assets (asset_make VARCHAR, asset_model VARCHAR, asset_details VARCHAR, asset_disposed_date VARCHAR)
List the all the assets make, model, details by the disposed date ascendingly.
<s>[INST] Given the following SQL query and context: Query: SELECT asset_make, asset_model, asset_details FROM Assets ORDER BY asset_disposed_date Context: CREATE TABLE Assets (asset_make VARCHAR, asset_model VARCHAR, asset_details VARCHAR, asset_disposed_date VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List the all the assets make, model, details by the disposed date ascendingly. The answer to your question is: SELECT asset_make, asset_model, asset_details FROM Assets ORDER BY asset_disposed_date. [/s>
SELECT part_id, chargeable_amount FROM Parts ORDER BY chargeable_amount LIMIT 1
CREATE TABLE Parts (part_id VARCHAR, chargeable_amount VARCHAR)
Which part has the least chargeable amount? List the part id and amount.
<s>[INST] Given the following SQL query and context: Query: SELECT part_id, chargeable_amount FROM Parts ORDER BY chargeable_amount LIMIT 1 Context: CREATE TABLE Parts (part_id VARCHAR, chargeable_amount VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which part has the least chargeable amount? List the part id and amount. The answer to your question is: SELECT part_id, chargeable_amount FROM Parts ORDER BY chargeable_amount LIMIT 1. [/s>
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 LIMIT 1
CREATE TABLE Third_Party_Companies (company_name VARCHAR, company_id VARCHAR); CREATE TABLE Maintenance_Contracts (maintenance_contract_company_id VARCHAR, contract_start_date VARCHAR)
Which company started the earliest the maintenance contract? Show the company name.
<s>[INST] Given the following SQL query and context: Query: 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 LIMIT 1 Context: CREATE TABLE Third_Party_Companies (company_name VARCHAR, company_id VARCHAR); CREATE TABLE Maintenance_Contracts (maintenance_contract_company_id VARCHAR, contract_start_date VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which company started the earliest the maintenance contract? Show the company name. The answer to your question is: 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 LIMIT 1. [/s>
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
CREATE TABLE Maintenance_Contracts (maintenance_contract_company_id VARCHAR, contract_end_date VARCHAR); CREATE TABLE Third_Party_Companies (company_name VARCHAR, company_id VARCHAR, company_type_code VARCHAR); CREATE TABLE Ref_Company_Types (company_type_code VARCHAR)
What is the description of the type of the company who concluded its contracts most recently?
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Maintenance_Contracts (maintenance_contract_company_id VARCHAR, contract_end_date VARCHAR); CREATE TABLE Third_Party_Companies (company_name VARCHAR, company_id VARCHAR, company_type_code VARCHAR); CREATE TABLE Ref_Company_Types (company_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the description of the type of the company who concluded its contracts most recently? The answer to your question is: 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. [/s>
SELECT gender FROM staff GROUP BY gender ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE staff (gender VARCHAR)
Which gender makes up the majority of the staff?
<s>[INST] Given the following SQL query and context: Query: SELECT gender FROM staff GROUP BY gender ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE staff (gender VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which gender makes up the majority of the staff? The answer to your question is: SELECT gender FROM staff GROUP BY gender ORDER BY COUNT(*) DESC LIMIT 1. [/s>
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
CREATE TABLE Engineer_Visits (contact_staff_id VARCHAR); CREATE TABLE Staff (staff_name VARCHAR, staff_id VARCHAR)
How many engineers did each staff contact? List both the contact staff name and number of engineers contacted.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Engineer_Visits (contact_staff_id VARCHAR); CREATE TABLE Staff (staff_name VARCHAR, staff_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many engineers did each staff contact? List both the contact staff name and number of engineers contacted. The answer to your question is: 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. [/s>
SELECT asset_model FROM Assets WHERE NOT asset_id IN (SELECT asset_id FROM Fault_Log)
CREATE TABLE Fault_Log (asset_model VARCHAR, asset_id VARCHAR); CREATE TABLE Assets (asset_model VARCHAR, asset_id VARCHAR)
Which assets did not incur any fault log? List the asset model.
<s>[INST] Given the following SQL query and context: Query: SELECT asset_model FROM Assets WHERE NOT asset_id IN (SELECT asset_id FROM Fault_Log) Context: CREATE TABLE Fault_Log (asset_model VARCHAR, asset_id VARCHAR); CREATE TABLE Assets (asset_model VARCHAR, asset_id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which assets did not incur any fault log? List the asset model. The answer to your question is: SELECT asset_model FROM Assets WHERE NOT asset_id IN (SELECT asset_id FROM Fault_Log). [/s>
SELECT local_authority, services FROM station
CREATE TABLE station (local_authority VARCHAR, services VARCHAR)
list the local authorities and services provided by all stations.
<s>[INST] Given the following SQL query and context: Query: SELECT local_authority, services FROM station Context: CREATE TABLE station (local_authority VARCHAR, services VARCHAR) [/INST] Based on the provided SQL query and context, your question is: list the local authorities and services provided by all stations. The answer to your question is: SELECT local_authority, services FROM station. [/s>
SELECT train_number, name FROM train ORDER BY TIME
CREATE TABLE train (train_number VARCHAR, name VARCHAR, TIME VARCHAR)
show all train numbers and names ordered by their time from early to late.
<s>[INST] Given the following SQL query and context: Query: SELECT train_number, name FROM train ORDER BY TIME Context: CREATE TABLE train (train_number VARCHAR, name VARCHAR, TIME VARCHAR) [/INST] Based on the provided SQL query and context, your question is: show all train numbers and names ordered by their time from early to late. The answer to your question is: SELECT train_number, name FROM train ORDER BY TIME. [/s>
SELECT TIME, train_number FROM train WHERE destination = 'Chennai' ORDER BY TIME
CREATE TABLE train (TIME VARCHAR, train_number VARCHAR, destination VARCHAR)
Give me the times and numbers of all trains that go to Chennai, ordered by time.
<s>[INST] Given the following SQL query and context: Query: SELECT TIME, train_number FROM train WHERE destination = 'Chennai' ORDER BY TIME Context: CREATE TABLE train (TIME VARCHAR, train_number VARCHAR, destination VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Give me the times and numbers of all trains that go to Chennai, ordered by time. The answer to your question is: SELECT TIME, train_number FROM train WHERE destination = 'Chennai' ORDER BY TIME. [/s>
SELECT COUNT(*) FROM train WHERE name LIKE "%Express%"
CREATE TABLE train (name VARCHAR)
How many trains have 'Express' in their names?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM train WHERE name LIKE "%Express%" Context: CREATE TABLE train (name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many trains have 'Express' in their names? The answer to your question is: SELECT COUNT(*) FROM train WHERE name LIKE "%Express%". [/s>
SELECT train_number, TIME FROM train WHERE origin = 'Chennai' AND destination = 'Guruvayur'
CREATE TABLE train (train_number VARCHAR, TIME VARCHAR, origin VARCHAR, destination VARCHAR)
Find the number and time of the train that goes from Chennai to Guruvayur.
<s>[INST] Given the following SQL query and context: Query: SELECT train_number, TIME FROM train WHERE origin = 'Chennai' AND destination = 'Guruvayur' Context: CREATE TABLE train (train_number VARCHAR, TIME VARCHAR, origin VARCHAR, destination VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the number and time of the train that goes from Chennai to Guruvayur. The answer to your question is: SELECT train_number, TIME FROM train WHERE origin = 'Chennai' AND destination = 'Guruvayur'. [/s>
SELECT origin, COUNT(*) FROM train GROUP BY origin
CREATE TABLE train (origin VARCHAR)
Find the number of trains starting from each origin.
<s>[INST] Given the following SQL query and context: Query: SELECT origin, COUNT(*) FROM train GROUP BY origin Context: CREATE TABLE train (origin VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the number of trains starting from each origin. The answer to your question is: SELECT origin, COUNT(*) FROM train GROUP BY origin. [/s>
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
CREATE TABLE route (train_id VARCHAR); CREATE TABLE train (name VARCHAR, id VARCHAR)
Find the name of the train whose route runs through greatest number of stations.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE route (train_id VARCHAR); CREATE TABLE train (name VARCHAR, id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the name of the train whose route runs through greatest number of stations. The answer to your question is: 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. [/s>
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
CREATE TABLE route (station_id VARCHAR); CREATE TABLE station (network_name VARCHAR, services VARCHAR, id VARCHAR)
Find the number of trains for each station, as well as the station network name and services.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE route (station_id VARCHAR); CREATE TABLE station (network_name VARCHAR, services VARCHAR, id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the number of trains for each station, as well as the station network name and services. The answer to your question is: 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. [/s>
SELECT AVG(high_temperature), day_of_week FROM weekly_weather GROUP BY day_of_week
CREATE TABLE weekly_weather (day_of_week VARCHAR, high_temperature INTEGER)
What is the average high temperature for each day of week?
<s>[INST] Given the following SQL query and context: Query: SELECT AVG(high_temperature), day_of_week FROM weekly_weather GROUP BY day_of_week Context: CREATE TABLE weekly_weather (day_of_week VARCHAR, high_temperature INTEGER) [/INST] Based on the provided SQL query and context, your question is: What is the average high temperature for each day of week? The answer to your question is: SELECT AVG(high_temperature), day_of_week FROM weekly_weather GROUP BY day_of_week. [/s>
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"
CREATE TABLE weekly_weather (low_temperature INTEGER, precipitation INTEGER, station_id VARCHAR); CREATE TABLE station (id VARCHAR, network_name VARCHAR)
Give me the maximum low temperature and average precipitation at the Amersham station.
<s>[INST] Given the following SQL query and context: Query: 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" Context: CREATE TABLE weekly_weather (low_temperature INTEGER, precipitation INTEGER, station_id VARCHAR); CREATE TABLE station (id VARCHAR, network_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Give me the maximum low temperature and average precipitation at the Amersham station. The answer to your question is: 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". [/s>
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"
CREATE TABLE station (id VARCHAR, local_authority VARCHAR); CREATE TABLE route (station_id VARCHAR, train_id VARCHAR); CREATE TABLE train (name VARCHAR, time VARCHAR, id VARCHAR)
Find names and times of trains that run through stations for the local authority Chiltern.
<s>[INST] Given the following SQL query and context: Query: 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" Context: CREATE TABLE station (id VARCHAR, local_authority VARCHAR); CREATE TABLE route (station_id VARCHAR, train_id VARCHAR); CREATE TABLE train (name VARCHAR, time VARCHAR, id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find names and times of trains that run through stations for the local authority Chiltern. The answer to your question is: 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". [/s>
SELECT COUNT(DISTINCT services) FROM station
CREATE TABLE station (services VARCHAR)
How many different services are provided by all stations?
<s>[INST] Given the following SQL query and context: Query: SELECT COUNT(DISTINCT services) FROM station Context: CREATE TABLE station (services VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many different services are provided by all stations? The answer to your question is: SELECT COUNT(DISTINCT services) FROM station. [/s>
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
CREATE TABLE weekly_weather (station_id VARCHAR); CREATE TABLE station (id VARCHAR, local_authority VARCHAR)
Find the id and local authority of the station with has the highest average high temperature.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE weekly_weather (station_id VARCHAR); CREATE TABLE station (id VARCHAR, local_authority VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the id and local authority of the station with has the highest average high temperature. The answer to your question is: 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. [/s>
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
CREATE TABLE weekly_weather (station_id VARCHAR, precipitation INTEGER); CREATE TABLE station (id VARCHAR, local_authority VARCHAR)
Find the id and local authority of the station whose maximum precipitation is higher than 50.
<s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE weekly_weather (station_id VARCHAR, precipitation INTEGER); CREATE TABLE station (id VARCHAR, local_authority VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the id and local authority of the station whose maximum precipitation is higher than 50. The answer to your question is: 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. [/s>
SELECT MIN(low_temperature), MAX(wind_speed_mph) FROM weekly_weather
CREATE TABLE weekly_weather (low_temperature INTEGER, wind_speed_mph INTEGER)
show the lowest low temperature and highest wind speed in miles per hour.
<s>[INST] Given the following SQL query and context: Query: SELECT MIN(low_temperature), MAX(wind_speed_mph) FROM weekly_weather Context: CREATE TABLE weekly_weather (low_temperature INTEGER, wind_speed_mph INTEGER) [/INST] Based on the provided SQL query and context, your question is: show the lowest low temperature and highest wind speed in miles per hour. The answer to your question is: SELECT MIN(low_temperature), MAX(wind_speed_mph) FROM weekly_weather. [/s>
SELECT origin FROM train GROUP BY origin HAVING COUNT(*) > 1
CREATE TABLE train (origin VARCHAR)
Find the origins from which more than 1 train starts.
<s>[INST] Given the following SQL query and context: Query: SELECT origin FROM train GROUP BY origin HAVING COUNT(*) > 1 Context: CREATE TABLE train (origin VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the origins from which more than 1 train starts. The answer to your question is: SELECT origin FROM train GROUP BY origin HAVING COUNT(*) > 1. [/s>