db_id
stringclasses
140 values
schema
listlengths
0
26
question
stringlengths
16
224
query
stringlengths
18
577
query_toks
listlengths
4
90
query_toks_no_value
listlengths
4
125
question_toks
listlengths
4
44
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
List all information about the assessment notes sorted by date in ascending order.
SELECT * FROM Assessment_Notes ORDER BY date_of_notes ASC
[ "SELECT", "*", "FROM", "Assessment_Notes", "ORDER", "BY", "date_of_notes", "ASC" ]
[ "select", "*", "from", "assessment_notes", "order", "by", "date_of_notes", "asc" ]
[ "List", "all", "information", "about", "the", "assessment", "notes", "sorted", "by", "date", "in", "ascending", "order", "." ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
List all cities of addresses in alphabetical order.
SELECT city FROM Addresses ORDER BY city
[ "SELECT", "city", "FROM", "Addresses", "ORDER", "BY", "city" ]
[ "select", "city", "from", "addresses", "order", "by", "city" ]
[ "List", "all", "cities", "of", "addresses", "in", "alphabetical", "order", "." ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
Find the first names and last names of teachers in alphabetical order of last name.
SELECT first_name , last_name FROM Teachers ORDER BY last_name
[ "SELECT", "first_name", ",", "last_name", "FROM", "Teachers", "ORDER", "BY", "last_name" ]
[ "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", "." ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
Find all information about student addresses, and sort by monthly rental in descending order.
SELECT * FROM Student_Addresses ORDER BY monthly_rental DESC
[ "SELECT", "*", "FROM", "Student_Addresses", "ORDER", "BY", "monthly_rental", "DESC" ]
[ "select", "*", "from", "student_addresses", "order", "by", "monthly_rental", "desc" ]
[ "Find", "all", "information", "about", "student", "addresses", ",", "and", "sort", "by", "monthly", "rental", "in", "descending", "order", "." ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
Find the id and first name of the student that has the most number of assessment notes?
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
[ "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" ]
[ "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", "value" ]
[ "Find", "the", "id", "and", "first", "name", "of", "the", "student", "that", "has", "the", "most", "number", "of", "assessment", "notes", "?" ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
Find the ids and first names of the 3 teachers that have the most number of assessment notes?
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
[ "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" ]
[ "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", "value" ]
[ "Find", "the", "ids", "and", "first", "names", "of", "the", "3", "teachers", "that", "have", "the", "most", "number", "of", "assessment", "notes", "?" ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
Find the id and last name of the student that has the most behavior incidents?
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
[ "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" ]
[ "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", "value" ]
[ "Find", "the", "id", "and", "last", "name", "of", "the", "student", "that", "has", "the", "most", "behavior", "incidents", "?" ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
Find the id and last name of the teacher that has the most detentions with detention type code "AFTER"?
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
[ "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" ]
[ "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", "=", "value", "group", "by", "t1", ".", "teacher_id", "order", "by", "count", "(", "*", ")", "desc", "limit", "value" ]
[ "Find", "the", "id", "and", "last", "name", "of", "the", "teacher", "that", "has", "the", "most", "detentions", "with", "detention", "type", "code", "``", "AFTER", "''", "?" ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
What are the id and first name of the student whose addresses have the highest average monthly rental?
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
[ "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" ]
[ "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", "value" ]
[ "What", "are", "the", "id", "and", "first", "name", "of", "the", "student", "whose", "addresses", "have", "the", "highest", "average", "monthly", "rental", "?" ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
Find the id and city of the student address with the highest average monthly rental.
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
[ "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" ]
[ "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", "value" ]
[ "Find", "the", "id", "and", "city", "of", "the", "student", "address", "with", "the", "highest", "average", "monthly", "rental", "." ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
What are the code and description of the most frequent behavior incident type?
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
[ "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" ]
[ "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", "value" ]
[ "What", "are", "the", "code", "and", "description", "of", "the", "most", "frequent", "behavior", "incident", "type", "?" ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
What are the code and description of the least frequent detention type ?
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
[ "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" ]
[ "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", "value" ]
[ "What", "are", "the", "code", "and", "description", "of", "the", "least", "frequent", "detention", "type", "?" ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
Find the dates of assessment notes for students with first name "Fanny".
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "Find", "the", "dates", "of", "assessment", "notes", "for", "students", "with", "first", "name", "``", "Fanny", "''", "." ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
Find the texts of assessment notes for teachers with last name "Schuster".
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "Find", "the", "texts", "of", "assessment", "notes", "for", "teachers", "with", "last", "name", "``", "Schuster", "''", "." ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
Find the start and end dates of behavior incidents of students with last name "Fahey".
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "Find", "the", "start", "and", "end", "dates", "of", "behavior", "incidents", "of", "students", "with", "last", "name", "``", "Fahey", "''", "." ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
Find the start and end dates of detentions of teachers with last name "Schultz".
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "Find", "the", "start", "and", "end", "dates", "of", "detentions", "of", "teachers", "with", "last", "name", "``", "Schultz", "''", "." ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
What are the id and zip code of the address with the highest monthly rental?
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
[ "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" ]
[ "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", "value" ]
[ "What", "are", "the", "id", "and", "zip", "code", "of", "the", "address", "with", "the", "highest", "monthly", "rental", "?" ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
What is the cell phone number of the student whose address has the lowest monthly rental?
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
[ "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" ]
[ "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", "value" ]
[ "What", "is", "the", "cell", "phone", "number", "of", "the", "student", "whose", "address", "has", "the", "lowest", "monthly", "rental", "?" ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
What are the monthly rentals of student addresses in Texas state?
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "What", "are", "the", "monthly", "rentals", "of", "student", "addresses", "in", "Texas", "state", "?" ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
What are the first names and last names of students with address in Wisconsin state?
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "What", "are", "the", "first", "names", "and", "last", "names", "of", "students", "with", "address", "in", "Wisconsin", "state", "?" ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
What are the line 1 and average monthly rentals of all student addresses?
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
[ "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" ]
[ "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", "?" ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
What is the zip code of the address where the teacher with first name "Lyla" lives?
SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = "Lyla"
[ "SELECT", "T1.zip_postcode", "FROM", "Addresses", "AS", "T1", "JOIN", "Teachers", "AS", "T2", "ON", "T1.address_id", "=", "T2.address_id", "WHERE", "T2.first_name", "=", "``", "Lyla", "''" ]
[ "select", "t1", ".", "zip_postcode", "from", "addresses", "as", "t1", "join", "teachers", "as", "t2", "on", "t1", ".", "address_id", "=", "t2", ".", "address_id", "where", "t2", ".", "first_name", "=", "value" ]
[ "What", "is", "the", "zip", "code", "of", "the", "address", "where", "the", "teacher", "with", "first", "name", "``", "Lyla", "''", "lives", "?" ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
What are the email addresses of teachers whose address has zip code "918"?
SELECT T2.email_address FROM Addresses AS T1 JOIN Teachers AS T2 ON T1.address_id = T2.address_id WHERE T1.zip_postcode = "918"
[ "SELECT", "T2.email_address", "FROM", "Addresses", "AS", "T1", "JOIN", "Teachers", "AS", "T2", "ON", "T1.address_id", "=", "T2.address_id", "WHERE", "T1.zip_postcode", "=", "``", "918", "''" ]
[ "select", "t2", ".", "email_address", "from", "addresses", "as", "t1", "join", "teachers", "as", "t2", "on", "t1", ".", "address_id", "=", "t2", ".", "address_id", "where", "t1", ".", "zip_postcode", "=", "value" ]
[ "What", "are", "the", "email", "addresses", "of", "teachers", "whose", "address", "has", "zip", "code", "``", "918", "''", "?" ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
How many students are not involved in any behavior incident?
SELECT count(*) FROM STUDENTS WHERE student_id NOT IN ( SELECT student_id FROM Behavior_Incident )
[ "SELECT", "count", "(", "*", ")", "FROM", "STUDENTS", "WHERE", "student_id", "NOT", "IN", "(", "SELECT", "student_id", "FROM", "Behavior_Incident", ")" ]
[ "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", "?" ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
Find the last names of teachers who are not involved in any detention.
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
[ "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" ]
[ "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", "." ]
behavior_monitoring
[ "CREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);", "CREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);", "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);", "CREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);", "CREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);", "CREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);", "CREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);" ]
What are the line 1 of addresses shared by some students and some teachers?
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
[ "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" ]
[ "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", "?" ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
Which assets have 2 parts and have less than 2 fault logs? List the asset id and detail.
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
[ "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" ]
[ "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", "(", "*", ")", "=", "value", "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", "(", "*", ")", "<", "value" ]
[ "Which", "assets", "have", "2", "parts", "and", "have", "less", "than", "2", "fault", "logs", "?", "List", "the", "asset", "id", "and", "detail", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
How many assets does each maintenance contract contain? List the number and the contract id.
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
[ "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" ]
[ "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", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
How many assets does each third party company supply? List the count and the company id.
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
[ "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" ]
[ "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", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
Which third party companies have at least 2 maintenance engineers or have at least 2 maintenance contracts? List the company id and name.
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
[ "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" ]
[ "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", "(", "*", ")", ">", "=", "value", "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", "(", "*", ")", ">", "=", "value" ]
[ "Which", "third", "party", "companies", "have", "at", "least", "2", "maintenance", "engineers", "or", "have", "at", "least", "2", "maintenance", "contracts", "?", "List", "the", "company", "id", "and", "name", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
What is the name and id of the staff who recorded the fault log but has not contacted any visiting engineers?
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
[ "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" ]
[ "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", "?" ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
Which engineer has visited the most times? Show the engineer id, first name and last name.
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
[ "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" ]
[ "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", "value" ]
[ "Which", "engineer", "has", "visited", "the", "most", "times", "?", "Show", "the", "engineer", "id", ",", "first", "name", "and", "last", "name", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
Which parts have more than 2 faults? Show the part name and id.
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
[ "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" ]
[ "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", "(", "*", ")", ">", "value" ]
[ "Which", "parts", "have", "more", "than", "2", "faults", "?", "Show", "the", "part", "name", "and", "id", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
List all every engineer's first name, last name, details and coresponding skill description.
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
[ "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" ]
[ "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", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
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.
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
[ "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" ]
[ "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", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
How many assets can each parts be used in? List the part name and the number.
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
[ "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" ]
[ "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", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
What are all the fault descriptions and the fault status of all the faults recoreded in the logs?
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
[ "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" ]
[ "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", "?" ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
How many engineer visits are required at most for a single fault log? List the number and the log entry id.
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
[ "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" ]
[ "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", "value" ]
[ "How", "many", "engineer", "visits", "are", "required", "at", "most", "for", "a", "single", "fault", "log", "?", "List", "the", "number", "and", "the", "log", "entry", "id", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
What are all the distinct last names of all the engineers?
SELECT DISTINCT last_name FROM Maintenance_Engineers
[ "SELECT", "DISTINCT", "last_name", "FROM", "Maintenance_Engineers" ]
[ "select", "distinct", "last_name", "from", "maintenance_engineers" ]
[ "What", "are", "all", "the", "distinct", "last", "names", "of", "all", "the", "engineers", "?" ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
How many fault status codes are recorded in the fault log parts table?
SELECT DISTINCT fault_status FROM Fault_Log_Parts
[ "SELECT", "DISTINCT", "fault_status", "FROM", "Fault_Log_Parts" ]
[ "select", "distinct", "fault_status", "from", "fault_log_parts" ]
[ "How", "many", "fault", "status", "codes", "are", "recorded", "in", "the", "fault", "log", "parts", "table", "?" ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
Which engineers have never visited to maintain the assets? List the engineer first name and last name.
SELECT first_name , last_name FROM Maintenance_Engineers WHERE engineer_id NOT IN (SELECT engineer_id FROM Engineer_Visits)
[ "SELECT", "first_name", ",", "last_name", "FROM", "Maintenance_Engineers", "WHERE", "engineer_id", "NOT", "IN", "(", "SELECT", "engineer_id", "FROM", "Engineer_Visits", ")" ]
[ "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", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
List the asset id, details, make and model for every asset.
SELECT asset_id , asset_details , asset_make , asset_model FROM Assets
[ "SELECT", "asset_id", ",", "asset_details", ",", "asset_make", ",", "asset_model", "FROM", "Assets" ]
[ "select", "asset_id", ",", "asset_details", ",", "asset_make", ",", "asset_model", "from", "assets" ]
[ "List", "the", "asset", "id", ",", "details", ",", "make", "and", "model", "for", "every", "asset", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
When was the first asset acquired?
SELECT asset_acquired_date FROM Assets ORDER BY asset_acquired_date ASC LIMIT 1
[ "SELECT", "asset_acquired_date", "FROM", "Assets", "ORDER", "BY", "asset_acquired_date", "ASC", "LIMIT", "1" ]
[ "select", "asset_acquired_date", "from", "assets", "order", "by", "asset_acquired_date", "asc", "limit", "value" ]
[ "When", "was", "the", "first", "asset", "acquired", "?" ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
Which part fault requires the most number of skills to fix? List part id and name.
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
[ "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" ]
[ "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", "value" ]
[ "Which", "part", "fault", "requires", "the", "most", "number", "of", "skills", "to", "fix", "?", "List", "part", "id", "and", "name", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
Which kind of part has the least number of faults? List the part name.
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
[ "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" ]
[ "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", "value" ]
[ "Which", "kind", "of", "part", "has", "the", "least", "number", "of", "faults", "?", "List", "the", "part", "name", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
Among those engineers who have visited, which engineer makes the least number of visits? List the engineer id, first name and last name.
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
[ "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" ]
[ "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", "value" ]
[ "Among", "those", "engineers", "who", "have", "visited", ",", "which", "engineer", "makes", "the", "least", "number", "of", "visits", "?", "List", "the", "engineer", "id", ",", "first", "name", "and", "last", "name", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
Which staff have contacted which engineers? List the staff name and the engineer first name and last name.
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
[ "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" ]
[ "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", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
Which fault log included the most number of faulty parts? List the fault log id, description and record time.
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
[ "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" ]
[ "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", "value" ]
[ "Which", "fault", "log", "included", "the", "most", "number", "of", "faulty", "parts", "?", "List", "the", "fault", "log", "id", ",", "description", "and", "record", "time", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
Which skill is used in fixing the most number of faults? List the skill id and description.
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
[ "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" ]
[ "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", "value" ]
[ "Which", "skill", "is", "used", "in", "fixing", "the", "most", "number", "of", "faults", "?", "List", "the", "skill", "id", "and", "description", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
What are all the distinct asset models?
SELECT DISTINCT asset_model FROM Assets
[ "SELECT", "DISTINCT", "asset_model", "FROM", "Assets" ]
[ "select", "distinct", "asset_model", "from", "assets" ]
[ "What", "are", "all", "the", "distinct", "asset", "models", "?" ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
List the all the assets make, model, details by the disposed date ascendingly.
SELECT asset_make , asset_model , asset_details FROM Assets ORDER BY asset_disposed_date ASC
[ "SELECT", "asset_make", ",", "asset_model", ",", "asset_details", "FROM", "Assets", "ORDER", "BY", "asset_disposed_date", "ASC" ]
[ "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", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
Which part has the least chargeable amount? List the part id and amount.
SELECT part_id , chargeable_amount FROM Parts ORDER BY chargeable_amount ASC LIMIT 1
[ "SELECT", "part_id", ",", "chargeable_amount", "FROM", "Parts", "ORDER", "BY", "chargeable_amount", "ASC", "LIMIT", "1" ]
[ "select", "part_id", ",", "chargeable_amount", "from", "parts", "order", "by", "chargeable_amount", "asc", "limit", "value" ]
[ "Which", "part", "has", "the", "least", "chargeable", "amount", "?", "List", "the", "part", "id", "and", "amount", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
Which company started the earliest the maintenance contract? Show the company name.
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
[ "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" ]
[ "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", "value" ]
[ "Which", "company", "started", "the", "earliest", "the", "maintenance", "contract", "?", "Show", "the", "company", "name", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
What is the description of the type of the company who concluded its contracts most recently?
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
[ "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" ]
[ "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", "value" ]
[ "What", "is", "the", "description", "of", "the", "type", "of", "the", "company", "who", "concluded", "its", "contracts", "most", "recently", "?" ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
Which gender makes up the majority of the staff?
SELECT gender FROM staff GROUP BY gender ORDER BY count(*) DESC LIMIT 1
[ "SELECT", "gender", "FROM", "staff", "GROUP", "BY", "gender", "ORDER", "BY", "count", "(", "*", ")", "DESC", "LIMIT", "1" ]
[ "select", "gender", "from", "staff", "group", "by", "gender", "order", "by", "count", "(", "*", ")", "desc", "limit", "value" ]
[ "Which", "gender", "makes", "up", "the", "majority", "of", "the", "staff", "?" ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
How many engineers did each staff contact? List both the contact staff name and number of engineers contacted.
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
[ "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" ]
[ "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", "." ]
assets_maintenance
[ "CREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);", "CREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);", "CREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);", "CREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);", "CREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);", "CREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);", "CREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);", "CREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);", "CREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);", "CREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);", "CREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);" ]
Which assets did not incur any fault log? List the asset model.
SELECT asset_model FROM Assets WHERE asset_id NOT IN (SELECT asset_id FROM Fault_Log)
[ "SELECT", "asset_model", "FROM", "Assets", "WHERE", "asset_id", "NOT", "IN", "(", "SELECT", "asset_id", "FROM", "Fault_Log", ")" ]
[ "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", "." ]
station_weather
[ "CREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);", "CREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);" ]
list the local authorities and services provided by all stations.
SELECT local_authority , services FROM station
[ "SELECT", "local_authority", ",", "services", "FROM", "station" ]
[ "select", "local_authority", ",", "services", "from", "station" ]
[ "list", "the", "local", "authorities", "and", "services", "provided", "by", "all", "stations", "." ]
station_weather
[ "CREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);", "CREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);" ]
show all train numbers and names ordered by their time from early to late.
SELECT train_number , name FROM train ORDER BY TIME
[ "SELECT", "train_number", ",", "name", "FROM", "train", "ORDER", "BY", "TIME" ]
[ "select", "train_number", ",", "name", "from", "train", "order", "by", "time" ]
[ "show", "all", "train", "numbers", "and", "names", "ordered", "by", "their", "time", "from", "early", "to", "late", "." ]
station_weather
[ "CREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);", "CREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);" ]
Give me the times and numbers of all trains that go to Chennai, ordered by time.
SELECT TIME , train_number FROM train WHERE destination = 'Chennai' ORDER BY TIME
[ "SELECT", "TIME", ",", "train_number", "FROM", "train", "WHERE", "destination", "=", "'Chennai", "'", "ORDER", "BY", "TIME" ]
[ "select", "time", ",", "train_number", "from", "train", "where", "destination", "=", "value", "order", "by", "time" ]
[ "Give", "me", "the", "times", "and", "numbers", "of", "all", "trains", "that", "go", "to", "Chennai", ",", "ordered", "by", "time", "." ]
station_weather
[ "CREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);", "CREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);" ]
How many trains have 'Express' in their names?
SELECT count(*) FROM train WHERE name LIKE "%Express%"
[ "SELECT", "count", "(", "*", ")", "FROM", "train", "WHERE", "name", "LIKE", "``", "%", "Express", "%", "''" ]
[ "select", "count", "(", "*", ")", "from", "train", "where", "name", "like", "value" ]
[ "How", "many", "trains", "have", "'Express", "'", "in", "their", "names", "?" ]
station_weather
[ "CREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);", "CREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);" ]
Find the number and time of the train that goes from Chennai to Guruvayur.
SELECT train_number , TIME FROM train WHERE origin = 'Chennai' AND destination = 'Guruvayur'
[ "SELECT", "train_number", ",", "TIME", "FROM", "train", "WHERE", "origin", "=", "'Chennai", "'", "AND", "destination", "=", "'Guruvayur", "'" ]
[ "select", "train_number", ",", "time", "from", "train", "where", "origin", "=", "value", "and", "destination", "=", "value" ]
[ "Find", "the", "number", "and", "time", "of", "the", "train", "that", "goes", "from", "Chennai", "to", "Guruvayur", "." ]
station_weather
[ "CREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);", "CREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);" ]
Find the number of trains starting from each origin.
SELECT origin , count(*) FROM train GROUP BY origin
[ "SELECT", "origin", ",", "count", "(", "*", ")", "FROM", "train", "GROUP", "BY", "origin" ]
[ "select", "origin", ",", "count", "(", "*", ")", "from", "train", "group", "by", "origin" ]
[ "Find", "the", "number", "of", "trains", "starting", "from", "each", "origin", "." ]
station_weather
[ "CREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);", "CREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);" ]
Find the name of the train whose route runs through greatest number of stations.
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
[ "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" ]
[ "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", "value" ]
[ "Find", "the", "name", "of", "the", "train", "whose", "route", "runs", "through", "greatest", "number", "of", "stations", "." ]
station_weather
[ "CREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);", "CREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);" ]
Find the number of trains for each station, as well as the station network name and services.
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
[ "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" ]
[ "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", "." ]
station_weather
[ "CREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);", "CREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);" ]
What is the average high temperature for each day of week?
SELECT avg(high_temperature) , day_of_week FROM weekly_weather GROUP BY day_of_week
[ "SELECT", "avg", "(", "high_temperature", ")", ",", "day_of_week", "FROM", "weekly_weather", "GROUP", "BY", "day_of_week" ]
[ "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", "?" ]
station_weather
[ "CREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);", "CREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);" ]
Give me the maximum low temperature and average precipitation at the Amersham station.
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "Give", "me", "the", "maximum", "low", "temperature", "and", "average", "precipitation", "at", "the", "Amersham", "station", "." ]
station_weather
[ "CREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);", "CREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);" ]
Find names and times of trains that run through stations for the local authority Chiltern.
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "Find", "names", "and", "times", "of", "trains", "that", "run", "through", "stations", "for", "the", "local", "authority", "Chiltern", "." ]
station_weather
[ "CREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);", "CREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);" ]
How many different services are provided by all stations?
SELECT count(DISTINCT services) FROM station
[ "SELECT", "count", "(", "DISTINCT", "services", ")", "FROM", "station" ]
[ "select", "count", "(", "distinct", "services", ")", "from", "station" ]
[ "How", "many", "different", "services", "are", "provided", "by", "all", "stations", "?" ]
station_weather
[ "CREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);", "CREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);" ]
Find the id and local authority of the station with has the highest average high temperature.
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
[ "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" ]
[ "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", "value" ]
[ "Find", "the", "id", "and", "local", "authority", "of", "the", "station", "with", "has", "the", "highest", "average", "high", "temperature", "." ]
station_weather
[ "CREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);", "CREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);" ]
Find the id and local authority of the station whose maximum precipitation is higher than 50.
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
[ "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" ]
[ "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", ")", ">", "value" ]
[ "Find", "the", "id", "and", "local", "authority", "of", "the", "station", "whose", "maximum", "precipitation", "is", "higher", "than", "50", "." ]
station_weather
[ "CREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);", "CREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);" ]
show the lowest low temperature and highest wind speed in miles per hour.
SELECT min(low_temperature) , max(wind_speed_mph) FROM weekly_weather
[ "SELECT", "min", "(", "low_temperature", ")", ",", "max", "(", "wind_speed_mph", ")", "FROM", "weekly_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", "." ]
station_weather
[ "CREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);", "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);", "CREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);" ]
Find the origins from which more than 1 train starts.
SELECT origin FROM train GROUP BY origin HAVING count(*) > 1
[ "SELECT", "origin", "FROM", "train", "GROUP", "BY", "origin", "HAVING", "count", "(", "*", ")", ">", "1" ]
[ "select", "origin", "from", "train", "group", "by", "origin", "having", "count", "(", "*", ")", ">", "value" ]
[ "Find", "the", "origins", "from", "which", "more", "than", "1", "train", "starts", "." ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
Find the number of professors in accounting department.
SELECT count(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE DEPT_NAME = "Accounting"
[ "SELECT", "count", "(", "*", ")", "FROM", "professor", "AS", "T1", "JOIN", "department", "AS", "T2", "ON", "T1.dept_code", "=", "T2.dept_code", "WHERE", "DEPT_NAME", "=", "``", "Accounting", "''" ]
[ "select", "count", "(", "*", ")", "from", "professor", "as", "t1", "join", "department", "as", "t2", "on", "t1", ".", "dept_code", "=", "t2", ".", "dept_code", "where", "dept_name", "=", "value" ]
[ "Find", "the", "number", "of", "professors", "in", "accounting", "department", "." ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
How many professors are in the accounting dept?
SELECT count(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE DEPT_NAME = "Accounting"
[ "SELECT", "count", "(", "*", ")", "FROM", "professor", "AS", "T1", "JOIN", "department", "AS", "T2", "ON", "T1.dept_code", "=", "T2.dept_code", "WHERE", "DEPT_NAME", "=", "``", "Accounting", "''" ]
[ "select", "count", "(", "*", ")", "from", "professor", "as", "t1", "join", "department", "as", "t2", "on", "t1", ".", "dept_code", "=", "t2", ".", "dept_code", "where", "dept_name", "=", "value" ]
[ "How", "many", "professors", "are", "in", "the", "accounting", "dept", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
How many professors are teaching class with code ACCT-211?
SELECT count(DISTINCT PROF_NUM) FROM CLASS WHERE CRS_CODE = "ACCT-211"
[ "SELECT", "count", "(", "DISTINCT", "PROF_NUM", ")", "FROM", "CLASS", "WHERE", "CRS_CODE", "=", "``", "ACCT-211", "''" ]
[ "select", "count", "(", "distinct", "prof_num", ")", "from", "class", "where", "crs_code", "=", "value" ]
[ "How", "many", "professors", "are", "teaching", "class", "with", "code", "ACCT-211", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
How many professors teach a class with the code ACCT-211?
SELECT count(DISTINCT PROF_NUM) FROM CLASS WHERE CRS_CODE = "ACCT-211"
[ "SELECT", "count", "(", "DISTINCT", "PROF_NUM", ")", "FROM", "CLASS", "WHERE", "CRS_CODE", "=", "``", "ACCT-211", "''" ]
[ "select", "count", "(", "distinct", "prof_num", ")", "from", "class", "where", "crs_code", "=", "value" ]
[ "How", "many", "professors", "teach", "a", "class", "with", "the", "code", "ACCT-211", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
What is the first and last name of the professor in biology department?
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "What", "is", "the", "first", "and", "last", "name", "of", "the", "professor", "in", "biology", "department", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
What are the first and last name of all biology professors?
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "What", "are", "the", "first", "and", "last", "name", "of", "all", "biology", "professors", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
What are the first names and date of birth of professors teaching course ACCT-211?
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "What", "are", "the", "first", "names", "and", "date", "of", "birth", "of", "professors", "teaching", "course", "ACCT-211", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
What are the first names and birthdates of the professors in charge of ACCT-211?
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "What", "are", "the", "first", "names", "and", "birthdates", "of", "the", "professors", "in", "charge", "of", "ACCT-211", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
How many classes are professor whose last name is Graztevski has?
SELECT count(*) FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE T1.EMP_LNAME = 'Graztevski'
[ "SELECT", "count", "(", "*", ")", "FROM", "employee", "AS", "T1", "JOIN", "CLASS", "AS", "T2", "ON", "T1.EMP_NUM", "=", "T2.PROF_NUM", "WHERE", "T1.EMP_LNAME", "=", "'Graztevski", "'" ]
[ "select", "count", "(", "*", ")", "from", "employee", "as", "t1", "join", "class", "as", "t2", "on", "t1", ".", "emp_num", "=", "t2", ".", "prof_num", "where", "t1", ".", "emp_lname", "=", "value" ]
[ "How", "many", "classes", "are", "professor", "whose", "last", "name", "is", "Graztevski", "has", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
How many classes does the professor whose last name is Graztevski teach?
SELECT count(*) FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE T1.EMP_LNAME = 'Graztevski'
[ "SELECT", "count", "(", "*", ")", "FROM", "employee", "AS", "T1", "JOIN", "CLASS", "AS", "T2", "ON", "T1.EMP_NUM", "=", "T2.PROF_NUM", "WHERE", "T1.EMP_LNAME", "=", "'Graztevski", "'" ]
[ "select", "count", "(", "*", ")", "from", "employee", "as", "t1", "join", "class", "as", "t2", "on", "t1", ".", "emp_num", "=", "t2", ".", "prof_num", "where", "t1", ".", "emp_lname", "=", "value" ]
[ "How", "many", "classes", "does", "the", "professor", "whose", "last", "name", "is", "Graztevski", "teach", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
What is the code of the school where the accounting department belongs to?
SELECT school_code FROM department WHERE dept_name = "Accounting"
[ "SELECT", "school_code", "FROM", "department", "WHERE", "dept_name", "=", "``", "Accounting", "''" ]
[ "select", "school_code", "from", "department", "where", "dept_name", "=", "value" ]
[ "What", "is", "the", "code", "of", "the", "school", "where", "the", "accounting", "department", "belongs", "to", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
What is the school code of the accounting department?
SELECT school_code FROM department WHERE dept_name = "Accounting"
[ "SELECT", "school_code", "FROM", "department", "WHERE", "dept_name", "=", "``", "Accounting", "''" ]
[ "select", "school_code", "from", "department", "where", "dept_name", "=", "value" ]
[ "What", "is", "the", "school", "code", "of", "the", "accounting", "department", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
How many credits does course CIS-220 have, and what its description?
SELECT crs_credit , crs_description FROM course WHERE crs_code = 'CIS-220'
[ "SELECT", "crs_credit", ",", "crs_description", "FROM", "course", "WHERE", "crs_code", "=", "'CIS-220", "'" ]
[ "select", "crs_credit", ",", "crs_description", "from", "course", "where", "crs_code", "=", "value" ]
[ "How", "many", "credits", "does", "course", "CIS-220", "have", ",", "and", "what", "its", "description", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
What is the description for the CIS-220 and how many credits does it have?
SELECT crs_credit , crs_description FROM course WHERE crs_code = 'CIS-220'
[ "SELECT", "crs_credit", ",", "crs_description", "FROM", "course", "WHERE", "crs_code", "=", "'CIS-220", "'" ]
[ "select", "crs_credit", ",", "crs_description", "from", "course", "where", "crs_code", "=", "value" ]
[ "What", "is", "the", "description", "for", "the", "CIS-220", "and", "how", "many", "credits", "does", "it", "have", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
what is the address of history department?
SELECT dept_address FROM department WHERE dept_name = 'History'
[ "SELECT", "dept_address", "FROM", "department", "WHERE", "dept_name", "=", "'History", "'" ]
[ "select", "dept_address", "from", "department", "where", "dept_name", "=", "value" ]
[ "what", "is", "the", "address", "of", "history", "department", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
Where is the history department?
SELECT dept_address FROM department WHERE dept_name = 'History'
[ "SELECT", "dept_address", "FROM", "department", "WHERE", "dept_name", "=", "'History", "'" ]
[ "select", "dept_address", "from", "department", "where", "dept_name", "=", "value" ]
[ "Where", "is", "the", "history", "department", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
How many different locations does the school with code BUS has?
SELECT count(DISTINCT dept_address) FROM department WHERE school_code = 'BUS'
[ "SELECT", "count", "(", "DISTINCT", "dept_address", ")", "FROM", "department", "WHERE", "school_code", "=", "'BUS", "'" ]
[ "select", "count", "(", "distinct", "dept_address", ")", "from", "department", "where", "school_code", "=", "value" ]
[ "How", "many", "different", "locations", "does", "the", "school", "with", "code", "BUS", "has", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
What are the different locations of the school with the code BUS?
SELECT count(DISTINCT dept_address) FROM department WHERE school_code = 'BUS'
[ "SELECT", "count", "(", "DISTINCT", "dept_address", ")", "FROM", "department", "WHERE", "school_code", "=", "'BUS", "'" ]
[ "select", "count", "(", "distinct", "dept_address", ")", "from", "department", "where", "school_code", "=", "value" ]
[ "What", "are", "the", "different", "locations", "of", "the", "school", "with", "the", "code", "BUS", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
How many different locations does each school have?
SELECT count(DISTINCT dept_address) , school_code FROM department GROUP BY school_code
[ "SELECT", "count", "(", "DISTINCT", "dept_address", ")", ",", "school_code", "FROM", "department", "GROUP", "BY", "school_code" ]
[ "select", "count", "(", "distinct", "dept_address", ")", ",", "school_code", "from", "department", "group", "by", "school_code" ]
[ "How", "many", "different", "locations", "does", "each", "school", "have", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
Count different addresses of each school.
SELECT count(DISTINCT dept_address) , school_code FROM department GROUP BY school_code
[ "SELECT", "count", "(", "DISTINCT", "dept_address", ")", ",", "school_code", "FROM", "department", "GROUP", "BY", "school_code" ]
[ "select", "count", "(", "distinct", "dept_address", ")", ",", "school_code", "from", "department", "group", "by", "school_code" ]
[ "Count", "different", "addresses", "of", "each", "school", "." ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
Find the description and credit for the course QM-261?
SELECT crs_credit , crs_description FROM course WHERE crs_code = 'QM-261'
[ "SELECT", "crs_credit", ",", "crs_description", "FROM", "course", "WHERE", "crs_code", "=", "'QM-261", "'" ]
[ "select", "crs_credit", ",", "crs_description", "from", "course", "where", "crs_code", "=", "value" ]
[ "Find", "the", "description", "and", "credit", "for", "the", "course", "QM-261", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
What is the course description and number of credits for QM-261?
SELECT crs_credit , crs_description FROM course WHERE crs_code = 'QM-261'
[ "SELECT", "crs_credit", ",", "crs_description", "FROM", "course", "WHERE", "crs_code", "=", "'QM-261", "'" ]
[ "select", "crs_credit", ",", "crs_description", "from", "course", "where", "crs_code", "=", "value" ]
[ "What", "is", "the", "course", "description", "and", "number", "of", "credits", "for", "QM-261", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
Find the number of departments in each school.
SELECT count(DISTINCT dept_name) , school_code FROM department GROUP BY school_code
[ "SELECT", "count", "(", "DISTINCT", "dept_name", ")", ",", "school_code", "FROM", "department", "GROUP", "BY", "school_code" ]
[ "select", "count", "(", "distinct", "dept_name", ")", ",", "school_code", "from", "department", "group", "by", "school_code" ]
[ "Find", "the", "number", "of", "departments", "in", "each", "school", "." ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
How many departments are in each school?
SELECT count(DISTINCT dept_name) , school_code FROM department GROUP BY school_code
[ "SELECT", "count", "(", "DISTINCT", "dept_name", ")", ",", "school_code", "FROM", "department", "GROUP", "BY", "school_code" ]
[ "select", "count", "(", "distinct", "dept_name", ")", ",", "school_code", "from", "department", "group", "by", "school_code" ]
[ "How", "many", "departments", "are", "in", "each", "school", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
Find the number of different departments in each school whose number of different departments is less than 5.
SELECT count(DISTINCT dept_name) , school_code FROM department GROUP BY school_code HAVING count(DISTINCT dept_name) < 5
[ "SELECT", "count", "(", "DISTINCT", "dept_name", ")", ",", "school_code", "FROM", "department", "GROUP", "BY", "school_code", "HAVING", "count", "(", "DISTINCT", "dept_name", ")", "<", "5" ]
[ "select", "count", "(", "distinct", "dept_name", ")", ",", "school_code", "from", "department", "group", "by", "school_code", "having", "count", "(", "distinct", "dept_name", ")", "<", "value" ]
[ "Find", "the", "number", "of", "different", "departments", "in", "each", "school", "whose", "number", "of", "different", "departments", "is", "less", "than", "5", "." ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
How many different departments are there in each school that has less than 5 apartments?
SELECT count(DISTINCT dept_name) , school_code FROM department GROUP BY school_code HAVING count(DISTINCT dept_name) < 5
[ "SELECT", "count", "(", "DISTINCT", "dept_name", ")", ",", "school_code", "FROM", "department", "GROUP", "BY", "school_code", "HAVING", "count", "(", "DISTINCT", "dept_name", ")", "<", "5" ]
[ "select", "count", "(", "distinct", "dept_name", ")", ",", "school_code", "from", "department", "group", "by", "school_code", "having", "count", "(", "distinct", "dept_name", ")", "<", "value" ]
[ "How", "many", "different", "departments", "are", "there", "in", "each", "school", "that", "has", "less", "than", "5", "apartments", "?" ]
college_1
[ "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);", "CREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);", "CREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);", "CREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);", "CREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);" ]
How many sections does each course has?
SELECT count(*) , crs_code FROM CLASS GROUP BY crs_code
[ "SELECT", "count", "(", "*", ")", ",", "crs_code", "FROM", "CLASS", "GROUP", "BY", "crs_code" ]
[ "select", "count", "(", "*", ")", ",", "crs_code", "from", "class", "group", "by", "crs_code" ]
[ "How", "many", "sections", "does", "each", "course", "has", "?" ]