db_id
stringlengths
3
31
query
stringlengths
18
577
question
stringlengths
3
224
schema
stringlengths
177
6.14k
primary_keys
stringlengths
16
545
foreign_keys
stringlengths
16
1.48k
behavior_monitoring
SELECT * FROM Assessment_Notes ORDER BY date_of_notes ASC
List all information about the assessment notes sorted by date in ascending order.
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT city FROM Addresses ORDER BY city
List all cities of addresses in alphabetical order.
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT first_name , last_name FROM Teachers ORDER BY last_name
Find the first names and last names of teachers in alphabetical order of last name.
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT * FROM Student_Addresses ORDER BY monthly_rental DESC
Find all information about student addresses, and sort by monthly rental in descending order.
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T1.student_id , T2.first_name FROM Assessment_Notes AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1
Find the id and first name of the student that has the most number of assessment notes?
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T1.teacher_id , T2.first_name FROM Assessment_Notes AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id GROUP BY T1.teacher_id ORDER BY count(*) DESC LIMIT 3
Find the ids and first names of the 3 teachers that have the most number of assessment notes?
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T1.student_id , T2.last_name FROM Behavior_Incident AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1
Find the id and last name of the student that has the most behavior incidents?
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T1.teacher_id , T2.last_name FROM Detention AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T1.detention_type_code = "AFTER" GROUP BY T1.teacher_id ORDER BY count(*) DESC LIMIT 1
Find the id and last name of the teacher that has the most detentions with detention type code "AFTER"?
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T1.student_id , T2.first_name FROM Student_Addresses AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY AVG(monthly_rental) DESC LIMIT 1
What are the id and first name of the student whose addresses have the highest average monthly rental?
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T2.address_id , T1.city FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id GROUP BY T2.address_id ORDER BY AVG(monthly_rental) DESC LIMIT 1
Find the id and city of the student address with the highest average monthly rental.
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T1.incident_type_code , T2.incident_type_description FROM Behavior_Incident AS T1 JOIN Ref_Incident_Type AS T2 ON T1.incident_type_code = T2.incident_type_code GROUP BY T1.incident_type_code ORDER BY count(*) DESC LIMIT 1
What are the code and description of the most frequent behavior incident type?
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T1.detention_type_code , T2.detention_type_description FROM Detention AS T1 JOIN Ref_Detention_Type AS T2 ON T1.detention_type_code = T2.detention_type_code GROUP BY T1.detention_type_code ORDER BY count(*) ASC LIMIT 1
What are the code and description of the least frequent detention type ?
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T1.date_of_notes FROM Assessment_Notes AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.first_name = "Fanny"
Find the dates of assessment notes for students with first name "Fanny".
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T1.text_of_notes FROM Assessment_Notes AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.last_name = "Schuster"
Find the texts of assessment notes for teachers with last name "Schuster".
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T1.date_incident_start , date_incident_end FROM Behavior_Incident AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.last_name = "Fahey"
Find the start and end dates of behavior incidents of students with last name "Fahey".
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T1.datetime_detention_start , datetime_detention_end FROM Detention AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.last_name = "Schultz"
Find the start and end dates of detentions of teachers with last name "Schultz".
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T2.address_id , T1.zip_postcode FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id ORDER BY monthly_rental DESC LIMIT 1
What are the id and zip code of the address with the highest monthly rental?
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T2.cell_mobile_number FROM Student_Addresses AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.monthly_rental ASC LIMIT 1
What is the cell phone number of the student whose address has the lowest monthly rental?
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T2.monthly_rental FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id WHERE T1.state_province_county = "Texas"
What are the monthly rentals of student addresses in Texas state?
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T2.first_name , T2.last_name FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id = T2.address_id WHERE T1.state_province_county = "Wisconsin"
What are the first names and last names of students with address in Wisconsin state?
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T1.line_1 , avg(T2.monthly_rental) FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id GROUP BY T2.address_id
What are the line 1 and average monthly rentals of all student addresses?
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = "Lyla"
What is the zip code of the address where the teacher with first name "Lyla" lives?
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T2.email_address FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T1.zip_postcode = "918"
What are the email addresses of teachers whose address has zip code "918"?
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT count(*) FROM STUDENTS WHERE student_id NOT IN ( SELECT student_id FROM Behavior_Incident )
How many students are not involved in any behavior incident?
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT last_name FROM Teachers EXCEPT SELECT T1.last_name FROM Teachers AS T1 JOIN Detention AS T2 ON T1.teacher_id = T2.teacher_id
Find the last names of teachers who are not involved in any detention.
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
behavior_monitoring
SELECT T1.line_1 FROM Addresses AS T1 JOIN Students AS T2 ON T1.address_id = T2.address_id INTERSECT SELECT T1.line_1 FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id
What are the line 1 of addresses shared by some students and some teachers?
[Schema (values) (types)]: | behavior_monitoring | Ref_Address_Types : address_type_code (text) , address_type_description (text) | Ref_Detention_Type : detention_type_code (text) , detention_type_description (text) | Ref_Incident_Type : incident_type_code (text) , incident_type_description (text) | Addresses : address_id (text) , line_1 (text) , line_2 (text) , line_3 (text) , city (text) , zip_postcode (text) , state_province_county (text) , country (number) , other_address_details (text) | Students : student_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , cell_mobile_number (text) , email_address (text) , date_first_rental (number) , date_left_university (text) , other_student_details (text) | Teachers : teacher_id (text) , address_id (text) , first_name (text) , middle_name (text) , last_name (text) , gender (text) , cell_mobile_number (text) , email_address (number) , other_details (text) | Assessment_Notes : notes_id (text) , student_id (text) , teacher_id (text) , date_of_notes (text) , text_of_notes (text) , other_details (text) | Behavior_Incident : incident_id (text) , incident_type_code (text) , student_id (text) , date_incident_start (text) , date_incident_end (text) , incident_summary (text) , recommendations (text) , other_details (number) | Detention : detention_id (text) , detention_type_code (text) , teacher_id (text) , datetime_detention_start (text) , datetime_detention_end (text) , detention_summary (text) , other_details (text) | Student_Addresses : student_id (text) , address_id (text) , date_address_from (text) , date_address_to (text) , monthly_rental (text) , other_details (text) | Students_in_Detention : student_id (text) , detention_id (text) , incident_id (text);
[Primary Keys]: ref_address_types : address_type_code, ref_detention_type : detention_type_code, ref_incident_type : incident_type_code, addresses : address_id, students : student_id, teachers : teacher_id, assessment_notes : incident_id, behavior_incident : detention_id
[Foreign Keys]: students : address_id = addresses : address_id | teachers : address_id = addresses : address_id | assessment_notes : teacher_id = teachers : teacher_id | assessment_notes : student_id = students : student_id | behavior_incident : student_id = students : student_id | behavior_incident : incident_type_code = ref_incident_type : incident_type_code | detention : teacher_id = teachers : teacher_id | detention : detention_type_code = ref_detention_type : detention_type_code | student_addresses : student_id = students : student_id | student_addresses : address_id = addresses : address_id | students_in_detention : student_id = students : student_id | students_in_detention : detention_id = detention : detention_id | students_in_detention : incident_id = behavior_incident : incident_id
assets_maintenance
SELECT T1.asset_id , T1.asset_details FROM Assets AS T1 JOIN Asset_Parts AS T2 ON T1.asset_id = T2.asset_id GROUP BY T1.asset_id HAVING count(*) = 2 INTERSECT SELECT T1.asset_id , T1.asset_details FROM Assets AS T1 JOIN Fault_Log AS T2 ON T1.asset_id = T2.asset_id GROUP BY T1.asset_id HAVING count(*) < 2
Which assets have 2 parts and have less than 2 fault logs? List the asset id and detail.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT count(*) , T1.maintenance_contract_id FROM Maintenance_Contracts AS T1 JOIN Assets AS T2 ON T1.maintenance_contract_id = T2.maintenance_contract_id GROUP BY T1.maintenance_contract_id
How many assets does each maintenance contract contain? List the number and the contract id.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT count(*) , T1.company_id FROM Third_Party_Companies AS T1 JOIN Assets AS T2 ON T1.company_id = T2.supplier_company_id GROUP BY T1.company_id
How many assets does each third party company supply? List the count and the company id.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.company_id , T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Engineers AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id HAVING count(*) >= 2 UNION SELECT T3.company_id , T3.company_name FROM Third_Party_Companies AS T3 JOIN Maintenance_Contracts AS T4 ON T3.company_id = T4.maintenance_contract_company_id GROUP BY T3.company_id HAVING count(*) >= 2
Which third party companies have at least 2 maintenance engineers or have at least 2 maintenance contracts? List the company id and name.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.staff_name , T1.staff_id FROM Staff AS T1 JOIN Fault_Log AS T2 ON T1.staff_id = T2.recorded_by_staff_id EXCEPT SELECT T3.staff_name , T3.staff_id FROM Staff AS T3 JOIN Engineer_Visits AS T4 ON T3.staff_id = T4.contact_staff_id
What is the name and id of the staff who recorded the fault log but has not contacted any visiting engineers?
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.engineer_id , T1.first_name , T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 GROUP BY T1.engineer_id ORDER BY count(*) DESC LIMIT 1
Which engineer has visited the most times? Show the engineer id, first name and last name.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.part_name , T1.part_id FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_id HAVING count(*) > 2
Which parts have more than 2 faults? Show the part name and id.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.first_name , T1.last_name , T1.other_details , T3.skill_description FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id
List all every engineer's first name, last name, details and coresponding skill description.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.fault_short_name , T3.skill_description FROM Part_Faults AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.part_fault_id = T2.part_fault_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id
For all the faults of different parts, what are all the decriptions of the skills required to fix them? List the name of the faults and the skill description.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.part_name , count(*) FROM Parts AS T1 JOIN Asset_Parts AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name
How many assets can each parts be used in? List the part name and the number.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.fault_description , T2.fault_status FROM Fault_Log AS T1 JOIN Fault_Log_Parts AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id
What are all the fault descriptions and the fault status of all the faults recoreded in the logs?
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT count(*) , T1.fault_log_entry_id FROM Fault_Log AS T1 JOIN Engineer_Visits AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id ORDER BY count(*) DESC LIMIT 1
How many engineer visits are required at most for a single fault log? List the number and the log entry id.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT DISTINCT last_name FROM Maintenance_Engineers
What are all the distinct last names of all the engineers?
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT DISTINCT fault_status FROM Fault_Log_Parts
How many fault status codes are recorded in the fault log parts table?
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT first_name , last_name FROM Maintenance_Engineers WHERE engineer_id NOT IN (SELECT engineer_id FROM Engineer_Visits)
Which engineers have never visited to maintain the assets? List the engineer first name and last name.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT asset_id , asset_details , asset_make , asset_model FROM Assets
List the asset id, details, make and model for every asset.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT asset_acquired_date FROM Assets ORDER BY asset_acquired_date ASC LIMIT 1
When was the first asset acquired?
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.part_id , T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id JOIN Skills_Required_To_Fix AS T3 ON T2.part_fault_id = T3.part_fault_id GROUP BY T1.part_id ORDER BY count(*) DESC LIMIT 1
Which part fault requires the most number of skills to fix? List part id and name.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name ORDER BY count(*) ASC LIMIT 1
Which kind of part has the least number of faults? List the part name.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.engineer_id , T1.first_name , T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 ON T1.engineer_id = T2.engineer_id GROUP BY T1.engineer_id ORDER BY count(*) ASC LIMIT 1
Among those engineers who have visited, which engineer makes the least number of visits? List the engineer id, first name and last name.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.staff_name , T3.first_name , T3.last_name FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id JOIN Maintenance_Engineers AS T3 ON T2.engineer_id = T3.engineer_id
Which staff have contacted which engineers? List the staff name and the engineer first name and last name.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.fault_log_entry_id , T1.fault_description , T1.fault_log_entry_datetime FROM Fault_Log AS T1 JOIN Fault_Log_Parts AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id ORDER BY count(*) DESC LIMIT 1
Which fault log included the most number of faulty parts? List the fault log id, description and record time.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.skill_id , T1.skill_description FROM Skills AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.skill_id = T2.skill_id GROUP BY T1.skill_id ORDER BY count(*) DESC LIMIT 1
Which skill is used in fixing the most number of faults? List the skill id and description.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT DISTINCT asset_model FROM Assets
What are all the distinct asset models?
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT asset_make , asset_model , asset_details FROM Assets ORDER BY asset_disposed_date ASC
List the all the assets make, model, details by the disposed date ascendingly.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT part_id , chargeable_amount FROM Parts ORDER BY chargeable_amount ASC LIMIT 1
Which part has the least chargeable amount? List the part id and amount.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Contracts AS T2 ON T1.company_id = T2.maintenance_contract_company_id ORDER BY T2.contract_start_date ASC LIMIT 1
Which company started the earliest the maintenance contract? Show the company name.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Contracts AS T2 ON T1.company_id = T2.maintenance_contract_company_id JOIN Ref_Company_Types AS T3 ON T1.company_type_code = T3.company_type_code ORDER BY T2.contract_end_date DESC LIMIT 1
What is the description of the type of the company who concluded its contracts most recently?
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT gender FROM staff GROUP BY gender ORDER BY count(*) DESC LIMIT 1
Which gender makes up the majority of the staff?
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT T1.staff_name , count(*) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id GROUP BY T1.staff_name
How many engineers did each staff contact? List both the contact staff name and number of engineers contacted.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
assets_maintenance
SELECT asset_model FROM Assets WHERE asset_id NOT IN (SELECT asset_id FROM Fault_Log)
Which assets did not incur any fault log? List the asset model.
[Schema (values) (types)]: | assets_maintenance | Third_Party_Companies : company_id (text) , company_type (number) , company_name (text) , company_address (text) , other_company_details (text) | Maintenance_Contracts : maintenance_contract_id (text) , maintenance_contract_company_id (number) , contract_start_date (text) , contract_end_date (text) , other_contract_details (text) | Parts : part_id (text) , part_name (number) , chargeable_yn (text) , chargeable_amount (text) , other_part_details (text) | Skills : skill_id (text) , skill_code (number) , skill_description (text) | Staff : staff_id (text) , staff_name (number) , gender (text) , other_staff_details (text) | Assets : asset_id (text) , maintenance_contract_id (number) , supplier_company_id (text) , asset_details (text) , asset_make (text) , asset_model (text) , asset_acquired_date (number) , asset_disposed_date (number) , other_asset_details (time) | Asset_Parts : asset_id (text) , part_id (number) | Maintenance_Engineers : engineer_id (text) , company_id (number) , first_name (text) , last_name (text) , other_details (text) | Engineer_Skills : engineer_id (text) , skill_id (number) | Fault_Log : fault_log_entry_id (text) , asset_id (number) , recorded_by_staff_id (text) , fault_log_entry_datetime (text) , fault_description (text) , other_fault_details (text) | Engineer_Visits : engineer_visit_id (text) , contact_staff_id (number) , engineer_id (text) , fault_log_entry_id (text) , fault_status (text) , visit_start_datetime (text) , visit_end_datetime (number) , other_visit_details (number) | Part_Faults : part_fault_id (text) , part_id (number) , fault_short_name (text) , fault_description (text) , other_fault_details (text) | Fault_Log_Parts : fault_log_entry_id (text) , part_fault_id (number) , fault_status (text) | Skills_Required_To_Fix : part_fault_id (text) , skill_id (number);
[Primary Keys]: third_party_companies : company_id, maintenance_contracts : maintenance_contract_id, parts : part_id, skills : skill_id, staff : staff_id, assets : asset_id, asset_parts : engineer_id, maintenance_engineers : fault_log_entry_id, engineer_skills : engineer_visit_id, fault_log : part_fault_id
[Foreign Keys]: maintenance_contracts : maintenance_contract_company_id = third_party_companies : company_id | assets : supplier_company_id = third_party_companies : company_id | assets : maintenance_contract_id = maintenance_contracts : maintenance_contract_id | asset_parts : asset_id = assets : asset_id | asset_parts : part_id = parts : part_id | maintenance_engineers : company_id = third_party_companies : company_id | engineer_skills : skill_id = skills : skill_id | engineer_skills : engineer_id = maintenance_engineers : engineer_id | fault_log : recorded_by_staff_id = staff : staff_id | fault_log : asset_id = assets : asset_id | engineer_visits : contact_staff_id = staff : staff_id | engineer_visits : engineer_id = maintenance_engineers : engineer_id | engineer_visits : fault_log_entry_id = fault_log : fault_log_entry_id | part_faults : part_id = parts : part_id | fault_log_parts : fault_log_entry_id = fault_log : fault_log_entry_id | fault_log_parts : part_fault_id = part_faults : part_fault_id | skills_required_to_fix : skill_id = skills : skill_id | skills_required_to_fix : part_fault_id = part_faults : part_fault_id
station_weather
SELECT local_authority , services FROM station
list the local authorities and services provided by all stations.
[Schema (values) (types)]: | station_weather | train : id (text) , train_number (number) , name (number) , origin (text) , destination (text) , time (text) , interval (text) | station : id (text) , network_name (number) , services (number) , local_authority (text) | route : train_id (text) , station_id (number) | weekly_weather : station_id (text) , day_of_week (number) , high_temperature (number) , low_temperature (text) , precipitation (text) , wind_speed_mph (text);
[Primary Keys]: train : id, station : id, route : train_id, weekly_weather : station_id
[Foreign Keys]: route : station_id = station : id | route : train_id = train : id | weekly_weather : station_id = station : id
station_weather
SELECT train_number , name FROM train ORDER BY TIME
show all train numbers and names ordered by their time from early to late.
[Schema (values) (types)]: | station_weather | train : id (text) , train_number (number) , name (number) , origin (text) , destination (text) , time (text) , interval (text) | station : id (text) , network_name (number) , services (number) , local_authority (text) | route : train_id (text) , station_id (number) | weekly_weather : station_id (text) , day_of_week (number) , high_temperature (number) , low_temperature (text) , precipitation (text) , wind_speed_mph (text);
[Primary Keys]: train : id, station : id, route : train_id, weekly_weather : station_id
[Foreign Keys]: route : station_id = station : id | route : train_id = train : id | weekly_weather : station_id = station : id
station_weather
SELECT TIME , train_number FROM train WHERE destination = 'Chennai' ORDER BY TIME
Give me the times and numbers of all trains that go to Chennai, ordered by time.
[Schema (values) (types)]: | station_weather | train : id (text) , train_number (number) , name (number) , origin (text) , destination (text) , time (text) , interval (text) | station : id (text) , network_name (number) , services (number) , local_authority (text) | route : train_id (text) , station_id (number) | weekly_weather : station_id (text) , day_of_week (number) , high_temperature (number) , low_temperature (text) , precipitation (text) , wind_speed_mph (text);
[Primary Keys]: train : id, station : id, route : train_id, weekly_weather : station_id
[Foreign Keys]: route : station_id = station : id | route : train_id = train : id | weekly_weather : station_id = station : id
station_weather
SELECT count(*) FROM train WHERE name LIKE "%Express%"
How many trains have 'Express' in their names?
[Schema (values) (types)]: | station_weather | train : id (text) , train_number (number) , name (number) , origin (text) , destination (text) , time (text) , interval (text) | station : id (text) , network_name (number) , services (number) , local_authority (text) | route : train_id (text) , station_id (number) | weekly_weather : station_id (text) , day_of_week (number) , high_temperature (number) , low_temperature (text) , precipitation (text) , wind_speed_mph (text);
[Primary Keys]: train : id, station : id, route : train_id, weekly_weather : station_id
[Foreign Keys]: route : station_id = station : id | route : train_id = train : id | weekly_weather : station_id = station : id
station_weather
SELECT train_number , TIME FROM train WHERE origin = 'Chennai' AND destination = 'Guruvayur'
Find the number and time of the train that goes from Chennai to Guruvayur.
[Schema (values) (types)]: | station_weather | train : id (text) , train_number (number) , name (number) , origin (text) , destination (text) , time (text) , interval (text) | station : id (text) , network_name (number) , services (number) , local_authority (text) | route : train_id (text) , station_id (number) | weekly_weather : station_id (text) , day_of_week (number) , high_temperature (number) , low_temperature (text) , precipitation (text) , wind_speed_mph (text);
[Primary Keys]: train : id, station : id, route : train_id, weekly_weather : station_id
[Foreign Keys]: route : station_id = station : id | route : train_id = train : id | weekly_weather : station_id = station : id
station_weather
SELECT origin , count(*) FROM train GROUP BY origin
Find the number of trains starting from each origin.
[Schema (values) (types)]: | station_weather | train : id (text) , train_number (number) , name (number) , origin (text) , destination (text) , time (text) , interval (text) | station : id (text) , network_name (number) , services (number) , local_authority (text) | route : train_id (text) , station_id (number) | weekly_weather : station_id (text) , day_of_week (number) , high_temperature (number) , low_temperature (text) , precipitation (text) , wind_speed_mph (text);
[Primary Keys]: train : id, station : id, route : train_id, weekly_weather : station_id
[Foreign Keys]: route : station_id = station : id | route : train_id = train : id | weekly_weather : station_id = station : id
station_weather
SELECT t1.name FROM train AS t1 JOIN route AS t2 ON t1.id = t2.train_id GROUP BY t2.train_id ORDER BY count(*) DESC LIMIT 1
Find the name of the train whose route runs through greatest number of stations.
[Schema (values) (types)]: | station_weather | train : id (text) , train_number (number) , name (number) , origin (text) , destination (text) , time (text) , interval (text) | station : id (text) , network_name (number) , services (number) , local_authority (text) | route : train_id (text) , station_id (number) | weekly_weather : station_id (text) , day_of_week (number) , high_temperature (number) , low_temperature (text) , precipitation (text) , wind_speed_mph (text);
[Primary Keys]: train : id, station : id, route : train_id, weekly_weather : station_id
[Foreign Keys]: route : station_id = station : id | route : train_id = train : id | weekly_weather : station_id = station : id
station_weather
SELECT count(*) , t1.network_name , t1.services FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id GROUP BY t2.station_id
Find the number of trains for each station, as well as the station network name and services.
[Schema (values) (types)]: | station_weather | train : id (text) , train_number (number) , name (number) , origin (text) , destination (text) , time (text) , interval (text) | station : id (text) , network_name (number) , services (number) , local_authority (text) | route : train_id (text) , station_id (number) | weekly_weather : station_id (text) , day_of_week (number) , high_temperature (number) , low_temperature (text) , precipitation (text) , wind_speed_mph (text);
[Primary Keys]: train : id, station : id, route : train_id, weekly_weather : station_id
[Foreign Keys]: route : station_id = station : id | route : train_id = train : id | weekly_weather : station_id = station : id
station_weather
SELECT avg(high_temperature) , day_of_week FROM weekly_weather GROUP BY day_of_week
What is the average high temperature for each day of week?
[Schema (values) (types)]: | station_weather | train : id (text) , train_number (number) , name (number) , origin (text) , destination (text) , time (text) , interval (text) | station : id (text) , network_name (number) , services (number) , local_authority (text) | route : train_id (text) , station_id (number) | weekly_weather : station_id (text) , day_of_week (number) , high_temperature (number) , low_temperature (text) , precipitation (text) , wind_speed_mph (text);
[Primary Keys]: train : id, station : id, route : train_id, weekly_weather : station_id
[Foreign Keys]: route : station_id = station : id | route : train_id = train : id | weekly_weather : station_id = station : id
station_weather
SELECT max(t1.low_temperature) , avg(t1.precipitation) FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id WHERE t2.network_name = "Amersham"
Give me the maximum low temperature and average precipitation at the Amersham station.
[Schema (values) (types)]: | station_weather | train : id (text) , train_number (number) , name (number) , origin (text) , destination (text) , time (text) , interval (text) | station : id (text) , network_name (number) , services (number) , local_authority (text) | route : train_id (text) , station_id (number) | weekly_weather : station_id (text) , day_of_week (number) , high_temperature (number) , low_temperature (text) , precipitation (text) , wind_speed_mph (text);
[Primary Keys]: train : id, station : id, route : train_id, weekly_weather : station_id
[Foreign Keys]: route : station_id = station : id | route : train_id = train : id | weekly_weather : station_id = station : id
station_weather
SELECT t3.name , t3.time FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id JOIN train AS t3 ON t2.train_id = t3.id WHERE t1.local_authority = "Chiltern"
Find names and times of trains that run through stations for the local authority Chiltern.
[Schema (values) (types)]: | station_weather | train : id (text) , train_number (number) , name (number) , origin (text) , destination (text) , time (text) , interval (text) | station : id (text) , network_name (number) , services (number) , local_authority (text) | route : train_id (text) , station_id (number) | weekly_weather : station_id (text) , day_of_week (number) , high_temperature (number) , low_temperature (text) , precipitation (text) , wind_speed_mph (text);
[Primary Keys]: train : id, station : id, route : train_id, weekly_weather : station_id
[Foreign Keys]: route : station_id = station : id | route : train_id = train : id | weekly_weather : station_id = station : id
station_weather
SELECT count(DISTINCT services) FROM station
How many different services are provided by all stations?
[Schema (values) (types)]: | station_weather | train : id (text) , train_number (number) , name (number) , origin (text) , destination (text) , time (text) , interval (text) | station : id (text) , network_name (number) , services (number) , local_authority (text) | route : train_id (text) , station_id (number) | weekly_weather : station_id (text) , day_of_week (number) , high_temperature (number) , low_temperature (text) , precipitation (text) , wind_speed_mph (text);
[Primary Keys]: train : id, station : id, route : train_id, weekly_weather : station_id
[Foreign Keys]: route : station_id = station : id | route : train_id = train : id | weekly_weather : station_id = station : id
station_weather
SELECT t2.id , t2.local_authority FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id GROUP BY t1.station_id ORDER BY avg(high_temperature) DESC LIMIT 1
Find the id and local authority of the station with has the highest average high temperature.
[Schema (values) (types)]: | station_weather | train : id (text) , train_number (number) , name (number) , origin (text) , destination (text) , time (text) , interval (text) | station : id (text) , network_name (number) , services (number) , local_authority (text) | route : train_id (text) , station_id (number) | weekly_weather : station_id (text) , day_of_week (number) , high_temperature (number) , low_temperature (text) , precipitation (text) , wind_speed_mph (text);
[Primary Keys]: train : id, station : id, route : train_id, weekly_weather : station_id
[Foreign Keys]: route : station_id = station : id | route : train_id = train : id | weekly_weather : station_id = station : id
station_weather
SELECT t2.id , t2.local_authority FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id GROUP BY t1.station_id HAVING max(t1.precipitation) > 50
Find the id and local authority of the station whose maximum precipitation is higher than 50.
[Schema (values) (types)]: | station_weather | train : id (text) , train_number (number) , name (number) , origin (text) , destination (text) , time (text) , interval (text) | station : id (text) , network_name (number) , services (number) , local_authority (text) | route : train_id (text) , station_id (number) | weekly_weather : station_id (text) , day_of_week (number) , high_temperature (number) , low_temperature (text) , precipitation (text) , wind_speed_mph (text);
[Primary Keys]: train : id, station : id, route : train_id, weekly_weather : station_id
[Foreign Keys]: route : station_id = station : id | route : train_id = train : id | weekly_weather : station_id = station : id
station_weather
SELECT min(low_temperature) , max(wind_speed_mph) FROM weekly_weather
show the lowest low temperature and highest wind speed in miles per hour.
[Schema (values) (types)]: | station_weather | train : id (text) , train_number (number) , name (number) , origin (text) , destination (text) , time (text) , interval (text) | station : id (text) , network_name (number) , services (number) , local_authority (text) | route : train_id (text) , station_id (number) | weekly_weather : station_id (text) , day_of_week (number) , high_temperature (number) , low_temperature (text) , precipitation (text) , wind_speed_mph (text);
[Primary Keys]: train : id, station : id, route : train_id, weekly_weather : station_id
[Foreign Keys]: route : station_id = station : id | route : train_id = train : id | weekly_weather : station_id = station : id
station_weather
SELECT origin FROM train GROUP BY origin HAVING count(*) > 1
Find the origins from which more than 1 train starts.
[Schema (values) (types)]: | station_weather | train : id (text) , train_number (number) , name (number) , origin (text) , destination (text) , time (text) , interval (text) | station : id (text) , network_name (number) , services (number) , local_authority (text) | route : train_id (text) , station_id (number) | weekly_weather : station_id (text) , day_of_week (number) , high_temperature (number) , low_temperature (text) , precipitation (text) , wind_speed_mph (text);
[Primary Keys]: train : id, station : id, route : train_id, weekly_weather : station_id
[Foreign Keys]: route : station_id = station : id | route : train_id = train : id | weekly_weather : station_id = station : id
college_1
SELECT count(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE DEPT_NAME = "Accounting"
Find the number of professors in accounting department.
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT count(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE DEPT_NAME = "Accounting"
How many professors are in the accounting dept?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT count(DISTINCT PROF_NUM) FROM CLASS WHERE CRS_CODE = "ACCT-211"
How many professors are teaching class with code ACCT-211?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT count(DISTINCT PROF_NUM) FROM CLASS WHERE CRS_CODE = "ACCT-211"
How many professors teach a class with the code ACCT-211?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT T3.EMP_FNAME , T3.EMP_LNAME FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code JOIN employee AS T3 ON T1.EMP_NUM = T3.EMP_NUM WHERE DEPT_NAME = "Biology"
What is the first and last name of the professor in biology department?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT T3.EMP_FNAME , T3.EMP_LNAME FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code JOIN employee AS T3 ON T1.EMP_NUM = T3.EMP_NUM WHERE DEPT_NAME = "Biology"
What are the first and last name of all biology professors?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT DISTINCT T1.EMP_FNAME , T1.EMP_DOB FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE CRS_CODE = "ACCT-211"
What are the first names and date of birth of professors teaching course ACCT-211?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT DISTINCT T1.EMP_FNAME , T1.EMP_DOB FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE CRS_CODE = "ACCT-211"
What are the first names and birthdates of the professors in charge of ACCT-211?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT count(*) FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE T1.EMP_LNAME = 'Graztevski'
How many classes are professor whose last name is Graztevski has?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT count(*) FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE T1.EMP_LNAME = 'Graztevski'
How many classes does the professor whose last name is Graztevski teach?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT school_code FROM department WHERE dept_name = "Accounting"
What is the code of the school where the accounting department belongs to?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT school_code FROM department WHERE dept_name = "Accounting"
What is the school code of the accounting department?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT crs_credit , crs_description FROM course WHERE crs_code = 'CIS-220'
How many credits does course CIS-220 have, and what its description?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT crs_credit , crs_description FROM course WHERE crs_code = 'CIS-220'
What is the description for the CIS-220 and how many credits does it have?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT dept_address FROM department WHERE dept_name = 'History'
what is the address of history department?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT dept_address FROM department WHERE dept_name = 'History'
Where is the history department?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT count(DISTINCT dept_address) FROM department WHERE school_code = 'BUS'
How many different locations does the school with code BUS has?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT count(DISTINCT dept_address) FROM department WHERE school_code = 'BUS'
What are the different locations of the school with the code BUS?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT count(DISTINCT dept_address) , school_code FROM department GROUP BY school_code
How many different locations does each school have?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT count(DISTINCT dept_address) , school_code FROM department GROUP BY school_code
Count different addresses of each school.
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT crs_credit , crs_description FROM course WHERE crs_code = 'QM-261'
Find the description and credit for the course QM-261?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT crs_credit , crs_description FROM course WHERE crs_code = 'QM-261'
What is the course description and number of credits for QM-261?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT count(DISTINCT dept_name) , school_code FROM department GROUP BY school_code
Find the number of departments in each school.
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT count(DISTINCT dept_name) , school_code FROM department GROUP BY school_code
How many departments are in each school?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT count(DISTINCT dept_name) , school_code FROM department GROUP BY school_code HAVING count(DISTINCT dept_name) < 5
Find the number of different departments in each school whose number of different departments is less than 5.
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT count(DISTINCT dept_name) , school_code FROM department GROUP BY school_code HAVING count(DISTINCT dept_name) < 5
How many different departments are there in each school that has less than 5 apartments?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code
college_1
SELECT count(*) , crs_code FROM CLASS GROUP BY crs_code
How many sections does each course has?
[Schema (values) (types)]: | college_1 | CLASS : class_code (text) , crs_code (text) , class_section (text) , class_time (text) , class_room (text) , prof_num (text) | COURSE : crs_code (text) , dept_code (text) , crs_description (text) , crs_credit (text) | DEPARTMENT : dept_code (text) , dept_name (text) , school_code (text) , emp_num (text) , dept_address (text) , dept_extension (text) | EMPLOYEE : emp_num (text) , emp_lname (text) , emp_fname (text) , emp_initial (text) , emp_jobcode (text) , emp_hiredate (text) , emp_dob (number) | ENROLL : class_code (text) , stu_num (text) , enroll_grade (text) | PROFESSOR : emp_num (text) , dept_code (text) , prof_office (text) , prof_extension (text) , prof_high_degree (text) | STUDENT : stu_num (text) , stu_lname (text) , stu_fname (text) , stu_init (text) , stu_dob (text) , stu_hrs (text) , stu_class (number) , stu_gpa (text) , stu_transfer (text) , dept_code (text) , stu_phone (number) , prof_num (text);
[Primary Keys]: class : class_code, course : crs_code, department : dept_code, employee : emp_num, enroll : stu_num
[Foreign Keys]: class : prof_num = employee : emp_num | class : crs_code = course : crs_code | course : dept_code = department : dept_code | department : emp_num = employee : emp_num | enroll : stu_num = student : stu_num | enroll : class_code = class : class_code | professor : dept_code = department : dept_code | professor : emp_num = employee : emp_num | student : dept_code = department : dept_code