Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: How many registed students do each course have? List course name and the number of their registered students? [/INST]

Output: SELECT T3.course_name ,  count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id JOIN courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: For each course id, how many students are registered and what are the course names? [/INST]

Output: SELECT T3.course_name ,  count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id JOIN courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: Find id of candidates whose assessment code is "Pass"? [/INST]

Output: SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = "Pass";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids of the candidates that have an outcome code of Pass? [/INST]

Output: SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = "Pass";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: Find the cell mobile number of the candidates whose assessment code is "Fail"? [/INST]

Output: SELECT T3.cell_mobile_number FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN people AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = "Fail";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What are the cell phone numbers of the candidates that received an assessment code of "Fail"? [/INST]

Output: SELECT T3.cell_mobile_number FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN people AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = "Fail";


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What are the id of students who registered course 301? [/INST]

Output: SELECT student_id FROM student_course_attendance WHERE course_id  =  301;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids of the students who registered for course 301? [/INST]

Output: SELECT student_id FROM student_course_attendance WHERE course_id  =  301;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What is the id of the student who most recently registered course 301? [/INST]

Output: SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids of the students who registered for course 301 most recently? [/INST]

Output: SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: Find distinct cities of addresses of people? [/INST]

Output: SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What are the different cities where people live? [/INST]

Output: SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: Find distinct cities of address of students? [/INST]

Output: SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id JOIN students AS T3 ON T2.person_id = T3.student_id;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What are the different cities where students live? [/INST]

Output: SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id JOIN students AS T3 ON T2.person_id = T3.student_id;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: List the names of courses in alphabetical order? [/INST]

Output: SELECT course_name FROM courses ORDER BY course_name;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of the courses in alphabetical order? [/INST]

Output: SELECT course_name FROM courses ORDER BY course_name;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: List the first names of people in alphabetical order? [/INST]

Output: SELECT first_name FROM people ORDER BY first_name;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What are the first names of the people in alphabetical order? [/INST]

Output: SELECT first_name FROM people ORDER BY first_name;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What are the id of students who registered courses or attended courses? [/INST]

Output: SELECT student_id FROM student_course_registrations UNION SELECT student_id FROM student_course_attendance;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids of the students who either registered or attended a course? [/INST]

Output: SELECT student_id FROM student_course_registrations UNION SELECT student_id FROM student_course_attendance;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: Find the id of courses which are registered or attended by student whose id is 121? [/INST]

Output: SELECT course_id FROM student_course_registrations WHERE student_id = 121 UNION SELECT course_id FROM student_course_attendance WHERE student_id = 121;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids of the courses that are registered or attended by the student whose id is 121? [/INST]

Output: SELECT course_id FROM student_course_registrations WHERE student_id = 121 UNION SELECT course_id FROM student_course_attendance WHERE student_id = 121;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What are all info of students who registered courses but not attended courses? [/INST]

Output: SELECT * FROM student_course_registrations WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance);


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What are all details of the students who registered but did not attend any course? [/INST]

Output: SELECT * FROM student_course_registrations WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance);


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: List the id of students who registered course statistics in the order of registration date. [/INST]

Output: SELECT T2.student_id FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "statistics" ORDER BY T2.registration_date;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids of the students who registered course statistics by order of registration date? [/INST]

Output: SELECT T2.student_id FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "statistics" ORDER BY T2.registration_date;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: List the id of students who attended  statistics courses in the order of attendance date. [/INST]

Output: SELECT T2.student_id FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "statistics" ORDER BY T2.date_of_attendance;


Input:
[INST] Here is a database schema:
Addresses :
address_id [ INT ] primary_key
line_1 [ TEXT ]
line_2 [ TEXT ]
city [ TEXT ]
zip_postcode [ TEXT ]
state_province_county [ TEXT ]
country [ TEXT ]

People :
person_id [ INT ] primary_key
first_name [ TEXT ]
middle_name [ TEXT ]
last_name [ TEXT ]
cell_mobile_number [ TEXT ]
email_address [ TEXT ]
login_name [ TEXT ]
password [ TEXT ]

Students :
student_id [ INT ] primary_key Students.student_id = People.person_id
student_details [ TEXT ]

Courses :
course_id [ TEXT ] primary_key
course_name [ TEXT ]
course_description [ TEXT ]
other_details [ TEXT ]

People_Addresses :
person_address_id [ INT ] primary_key
person_id [ INT ] People_Addresses.person_id = People.person_id
address_id [ INT ] People_Addresses.address_id = Addresses.address_id
date_from [ TEXT ]
date_to [ TEXT ]

Student_Course_Registrations :
student_id [ INT ] primary_key Student_Course_Registrations.student_id = Students.student_id
course_id [ INT ] Student_Course_Registrations.course_id = Courses.course_id
registration_date [ TEXT ]

Student_Course_Attendance :
student_id [ INT ] primary_key Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
course_id [ INT ] Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
date_of_attendance [ TEXT ]

Candidates :
candidate_id [ INT ] primary_key Candidates.candidate_id = People.person_id
candidate_details [ TEXT ]

Candidate_Assessments :
candidate_id [ INT ] primary_key Candidate_Assessments.candidate_id = Candidates.candidate_id
qualification [ TEXT ]
assessment_date [ TEXT ]
asessment_outcome_code [ TEXT ]

Please write me a SQL statement that answers the following question: What are the ids of the students who attended courses in the statistics department in order of attendance date. [/INST]

Output: SELECT T2.student_id FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "statistics" ORDER BY T2.date_of_attendance;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: Give me the dates when the max temperature was higher than 85. [/INST]

Output: SELECT date FROM weather WHERE max_temperature_f  >  85;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What are the dates with a maximum temperature higher than 85? [/INST]

Output: SELECT date FROM weather WHERE max_temperature_f  >  85;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What are the names of stations that have latitude lower than 37.5? [/INST]

Output: SELECT name FROM station WHERE lat  <  37.5;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What are the names of all stations with a latitude smaller than 37.5? [/INST]

Output: SELECT name FROM station WHERE lat  <  37.5;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: For each city, return the highest latitude among its stations. [/INST]

Output: SELECT city ,  max(lat) FROM station GROUP BY city;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: For each city, what is the highest latitude for its stations? [/INST]

Output: SELECT city ,  max(lat) FROM station GROUP BY city;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: Give me the start station and end station for the trips with the three oldest id. [/INST]

Output: SELECT start_station_name ,  end_station_name FROM trip ORDER BY id LIMIT 3;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What is the station station and end station for the trips with the three smallest ids? [/INST]

Output: SELECT start_station_name ,  end_station_name FROM trip ORDER BY id LIMIT 3;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What is the average latitude and longitude of stations located in San Jose city? [/INST]

Output: SELECT avg(lat) ,  avg(long) FROM station WHERE city  =  "San Jose";


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What is the average latitude and longitude in San Jose? [/INST]

Output: SELECT avg(lat) ,  avg(long) FROM station WHERE city  =  "San Jose";


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What is the id of the trip that has the shortest duration? [/INST]

Output: SELECT id FROM trip ORDER BY duration LIMIT 1;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What is the id of the shortest trip? [/INST]

Output: SELECT id FROM trip ORDER BY duration LIMIT 1;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What is the total and maximum duration of trips with bike id 636? [/INST]

Output: SELECT sum(duration) ,  max(duration) FROM trip WHERE bike_id  =  636;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What is the total and maximum duration for all trips with the bike id 636? [/INST]

Output: SELECT sum(duration) ,  max(duration) FROM trip WHERE bike_id  =  636;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: For each zip code, return the average mean temperature of August there. [/INST]

Output: SELECT zip_code  ,  avg(mean_temperature_f) FROM weather WHERE date LIKE "8/%" GROUP BY zip_code;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: For each zip code, what is the average mean temperature for all dates that start with '8'? [/INST]

Output: SELECT zip_code  ,  avg(mean_temperature_f) FROM weather WHERE date LIKE "8/%" GROUP BY zip_code;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: From the trip record, find the number of unique bikes. [/INST]

Output: SELECT count(DISTINCT bike_id) FROM trip;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: How many different bike ids are there? [/INST]

Output: SELECT count(DISTINCT bike_id) FROM trip;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What is the number of distinct cities the stations are located at? [/INST]

Output: SELECT count(DISTINCT city) FROM station;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: How many different cities have these stations? [/INST]

Output: SELECT count(DISTINCT city) FROM station;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: How many stations does Mountain View city has? [/INST]

Output: SELECT COUNT(*) FROM station WHERE city  =  "Mountain View";


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: How many stations are in Mountain View? [/INST]

Output: SELECT COUNT(*) FROM station WHERE city  =  "Mountain View";


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: Return the unique name for stations that have ever had 7 bikes available. [/INST]

Output: SELECT DISTINCT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id  =  T2.station_id WHERE T2.bikes_available  =  7;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What are the different names for each station that has ever had 7 bikes available? [/INST]

Output: SELECT DISTINCT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id  =  T2.station_id WHERE T2.bikes_available  =  7;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: Which start station had the most trips starting from August? Give me the name and id of the station. [/INST]

Output: SELECT start_station_name ,  start_station_id FROM trip WHERE start_date LIKE "8/%" GROUP BY start_station_name ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What are the start station's name and id for the one that had the most start trips in August? [/INST]

Output: SELECT start_station_name ,  start_station_id FROM trip WHERE start_date LIKE "8/%" GROUP BY start_station_name ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: Which bike traveled the most often in zip code 94002? [/INST]

Output: SELECT bike_id FROM trip WHERE zip_code  =  94002 GROUP BY bike_id ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What is the id of the bike that traveled the most in 94002? [/INST]

Output: SELECT bike_id FROM trip WHERE zip_code  =  94002 GROUP BY bike_id ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: How many days had both mean humidity above 50 and mean visibility above 8? [/INST]

Output: SELECT COUNT(*) FROM weather WHERE mean_humidity  >  50 AND mean_visibility_miles  >  8;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What is the number of days that had an average humity above 50 and an average visibility above 8? [/INST]

Output: SELECT COUNT(*) FROM weather WHERE mean_humidity  >  50 AND mean_visibility_miles  >  8;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What is the latitude, longitude, city of the station from which the shortest trip started? [/INST]

Output: SELECT T1.lat ,  T1.long ,  T1.city FROM station AS T1 JOIN trip AS T2 ON T1.id  =  T2.start_station_id ORDER BY T2.duration LIMIT 1;


Input:
[INST] Here is a database schema:
station :
id [ INT ] primary_key
name [ TEXT ]
lat [ INT ]
long [ INT ]
dock_count [ INT ]
city [ TEXT ]
installation_date [ TEXT ]

status :
station_id [ INT ] status.station_id = station.id
bikes_available [ INT ]
docks_available [ INT ]
time [ TEXT ]

trip :
id [ INT ] primary_key
duration [ INT ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INT ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INT ]
bike_id [ INT ]
subscription_type [ TEXT ]
zip_code [ INT ]

weather :
date [ TEXT ]
max_temperature_f [ INT ]
mean_temperature_f [ INT ]
min_temperature_f [ INT ]
max_dew_point_f [ INT ]
mean_dew_point_f [ INT ]
min_dew_point_f [ INT ]
max_humidity [ INT ]
mean_humidity [ INT ]
min_humidity [ INT ]
max_sea_level_pressure_inches [ INT ]
mean_sea_level_pressure_inches [ INT ]
min_sea_level_pressure_inches [ INT ]
max_visibility_miles [ INT ]
mean_visibility_miles [ INT ]
min_visibility_miles [ INT ]
max_wind_Speed_mph [ INT ]
mean_wind_speed_mph [ INT ]
max_gust_speed_mph [ INT ]
precipitation_inches [ INT ]
cloud_cover [ INT ]
events [ TEXT ]
wind_dir_degrees [ INT ]
zip_code [ INT ]

Please write me a SQL statement that answers the following question: What is the latitude, longitude, and city of the station from which the trip with smallest duration started? [/INST]

Output: SELECT T1.lat ,  T1.long ,  T1.city FROM station AS T1 JOIN trip AS T2 ON T1.id  =  T2.start_station_id ORDER BY T2.duration LIMIT 1;