db_id
stringclasses
20 values
query
stringlengths
25
323
question
stringlengths
22
144
create_w_keys
stringclasses
20 values
create_wo_keys
stringclasses
20 values
difficulty
stringclasses
4 values
zero_shot_request
stringlengths
527
3.29k
battle_death
SELECT count(*) FROM ship WHERE disposition_of_ship = 'Captured'
How many ships ended up being 'Captured'?
CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") );
CREATE TABLE battle (id INT, name TEXT, date TEXT, bulgarian_commander TEXT, latin_commander TEXT, result TEXT); CREATE TABLE ship (lost_in_battle INT, id INT, name TEXT, tonnage TEXT, ship_type TEXT, location TEXT, disposition_of_ship TEXT); CREATE TABLE death (caused_by_ship_id INT, id INT, note TEXT, killed INT, injured INT);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") ); QUESTION: How many ships ended up being 'Captured'?
battle_death
SELECT name , tonnage FROM ship ORDER BY name DESC
List the name and tonnage ordered by in descending alphaetical order for the names.
CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") );
CREATE TABLE battle (id INT, name TEXT, date TEXT, bulgarian_commander TEXT, latin_commander TEXT, result TEXT); CREATE TABLE ship (lost_in_battle INT, id INT, name TEXT, tonnage TEXT, ship_type TEXT, location TEXT, disposition_of_ship TEXT); CREATE TABLE death (caused_by_ship_id INT, id INT, note TEXT, killed INT, injured INT);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") ); QUESTION: List the name and tonnage ordered by in descending alphaetical order for the names.
battle_death
SELECT name , date FROM battle
List the name, date and result of each battle.
CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") );
CREATE TABLE battle (id INT, name TEXT, date TEXT, bulgarian_commander TEXT, latin_commander TEXT, result TEXT); CREATE TABLE ship (lost_in_battle INT, id INT, name TEXT, tonnage TEXT, ship_type TEXT, location TEXT, disposition_of_ship TEXT); CREATE TABLE death (caused_by_ship_id INT, id INT, note TEXT, killed INT, injured INT);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") ); QUESTION: List the name, date and result of each battle.
battle_death
SELECT max(killed) , min(killed) FROM death
What is maximum and minimum death toll caused each time?
CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") );
CREATE TABLE battle (id INT, name TEXT, date TEXT, bulgarian_commander TEXT, latin_commander TEXT, result TEXT); CREATE TABLE ship (lost_in_battle INT, id INT, name TEXT, tonnage TEXT, ship_type TEXT, location TEXT, disposition_of_ship TEXT); CREATE TABLE death (caused_by_ship_id INT, id INT, note TEXT, killed INT, injured INT);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") ); QUESTION: What is maximum and minimum death toll caused each time?
battle_death
SELECT avg(injured) FROM death
What is the average number of injuries caused each time?
CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") );
CREATE TABLE battle (id INT, name TEXT, date TEXT, bulgarian_commander TEXT, latin_commander TEXT, result TEXT); CREATE TABLE ship (lost_in_battle INT, id INT, name TEXT, tonnage TEXT, ship_type TEXT, location TEXT, disposition_of_ship TEXT); CREATE TABLE death (caused_by_ship_id INT, id INT, note TEXT, killed INT, injured INT);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") ); QUESTION: What is the average number of injuries caused each time?
battle_death
SELECT T1.id , T1.name FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle JOIN death AS T3 ON T2.id = T3.caused_by_ship_id GROUP BY T1.id HAVING sum(T3.killed) > 10
What are the ids and names of the battles that led to more than 10 people killed in total.
CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") );
CREATE TABLE battle (id INT, name TEXT, date TEXT, bulgarian_commander TEXT, latin_commander TEXT, result TEXT); CREATE TABLE ship (lost_in_battle INT, id INT, name TEXT, tonnage TEXT, ship_type TEXT, location TEXT, disposition_of_ship TEXT); CREATE TABLE death (caused_by_ship_id INT, id INT, note TEXT, killed INT, injured INT);
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") ); QUESTION: What are the ids and names of the battles that led to more than 10 people killed in total.
battle_death
SELECT T2.id , T2.name FROM death AS T1 JOIN ship AS t2 ON T1.caused_by_ship_id = T2.id GROUP BY T2.id ORDER BY count(*) DESC LIMIT 1
What is the ship id and name that caused most total injuries?
CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") );
CREATE TABLE battle (id INT, name TEXT, date TEXT, bulgarian_commander TEXT, latin_commander TEXT, result TEXT); CREATE TABLE ship (lost_in_battle INT, id INT, name TEXT, tonnage TEXT, ship_type TEXT, location TEXT, disposition_of_ship TEXT); CREATE TABLE death (caused_by_ship_id INT, id INT, note TEXT, killed INT, injured INT);
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") ); QUESTION: What is the ship id and name that caused most total injuries?
battle_death
SELECT count(DISTINCT RESULT) FROM battle
How many different results are there for the battles?
CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") );
CREATE TABLE battle (id INT, name TEXT, date TEXT, bulgarian_commander TEXT, latin_commander TEXT, result TEXT); CREATE TABLE ship (lost_in_battle INT, id INT, name TEXT, tonnage TEXT, ship_type TEXT, location TEXT, disposition_of_ship TEXT); CREATE TABLE death (caused_by_ship_id INT, id INT, note TEXT, killed INT, injured INT);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") ); QUESTION: How many different results are there for the battles?
battle_death
SELECT count(*) FROM battle WHERE id NOT IN ( SELECT lost_in_battle FROM ship WHERE tonnage = '225' );
How many battles did not lose any ship with tonnage '225'?
CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") );
CREATE TABLE battle (id INT, name TEXT, date TEXT, bulgarian_commander TEXT, latin_commander TEXT, result TEXT); CREATE TABLE ship (lost_in_battle INT, id INT, name TEXT, tonnage TEXT, ship_type TEXT, location TEXT, disposition_of_ship TEXT); CREATE TABLE death (caused_by_ship_id INT, id INT, note TEXT, killed INT, injured INT);
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") ); QUESTION: How many battles did not lose any ship with tonnage '225'?
battle_death
SELECT T1.name , T1.date FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.name = 'Lettice' INTERSECT SELECT T1.name , T1.date FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.name = 'HMS Atalanta'
List the name and date the battle that has lost the ship named 'Lettice' and the ship named 'HMS Atalanta'
CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") );
CREATE TABLE battle (id INT, name TEXT, date TEXT, bulgarian_commander TEXT, latin_commander TEXT, result TEXT); CREATE TABLE ship (lost_in_battle INT, id INT, name TEXT, tonnage TEXT, ship_type TEXT, location TEXT, disposition_of_ship TEXT); CREATE TABLE death (caused_by_ship_id INT, id INT, note TEXT, killed INT, injured INT);
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "battle" ( "id" int, "name" text, "date" text, "bulgarian_commander" text, "latin_commander" text, "result" text, primary key("id") ); CREATE TABLE "ship" ( "lost_in_battle" int, "id" int, "name" text, "tonnage" text, "ship_type" text, "location" text, "disposition_of_ship" text, primary key("id"), foreign key (`lost_in_battle`) references `battle`("id") ); CREATE TABLE "death" ( "caused_by_ship_id" int, "id" int, "note" text, "killed" int, "injured" int, primary key("id"), foreign key ("caused_by_ship_id") references `ship`("id") ); QUESTION: List the name and date the battle that has lost the ship named 'Lettice' and the ship named 'HMS Atalanta'
student_transcripts_tracking
SELECT line_1 , line_2 FROM addresses
what are all the addresses including line 1 and line 2?
CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) );
CREATE TABLE Addresses (address_id INTEGER, line_1 VARCHAR(255), line_2 VARCHAR(255), line_3 VARCHAR(255), city VARCHAR(255), zip_postcode VARCHAR(20), state_province_county VARCHAR(255), country VARCHAR(255), other_address_details VARCHAR(255)); CREATE TABLE Courses (course_id INTEGER, course_name VARCHAR(255), course_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Departments (department_id INTEGER, department_name VARCHAR(255), department_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Degree_Programs (degree_program_id INTEGER, department_id INTEGER, degree_summary_name VARCHAR(255), degree_summary_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Sections (section_id INTEGER, course_id INTEGER, section_name VARCHAR(255), section_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Semesters (semester_id INTEGER, semester_name VARCHAR(255), semester_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Students (student_id INTEGER, current_address_id INTEGER, permanent_address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(40), last_name VARCHAR(40), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), ssn VARCHAR(40), date_first_registered DATETIME, date_left DATETIME, other_student_details VARCHAR(255)); CREATE TABLE Student_Enrolment (student_enrolment_id INTEGER, degree_program_id INTEGER, semester_id INTEGER, student_id INTEGER, other_details VARCHAR(255)); CREATE TABLE Student_Enrolment_Courses (student_course_id INTEGER, course_id INTEGER, student_enrolment_id INTEGER); CREATE TABLE Transcripts (transcript_id INTEGER, transcript_date DATETIME, other_details VARCHAR(255)); CREATE TABLE Transcript_Contents (student_course_id INTEGER, transcript_id INTEGER);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) ); QUESTION: what are all the addresses including line 1 and line 2?
student_transcripts_tracking
SELECT count(*) FROM Courses
How many courses in total are listed?
CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) );
CREATE TABLE Addresses (address_id INTEGER, line_1 VARCHAR(255), line_2 VARCHAR(255), line_3 VARCHAR(255), city VARCHAR(255), zip_postcode VARCHAR(20), state_province_county VARCHAR(255), country VARCHAR(255), other_address_details VARCHAR(255)); CREATE TABLE Courses (course_id INTEGER, course_name VARCHAR(255), course_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Departments (department_id INTEGER, department_name VARCHAR(255), department_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Degree_Programs (degree_program_id INTEGER, department_id INTEGER, degree_summary_name VARCHAR(255), degree_summary_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Sections (section_id INTEGER, course_id INTEGER, section_name VARCHAR(255), section_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Semesters (semester_id INTEGER, semester_name VARCHAR(255), semester_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Students (student_id INTEGER, current_address_id INTEGER, permanent_address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(40), last_name VARCHAR(40), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), ssn VARCHAR(40), date_first_registered DATETIME, date_left DATETIME, other_student_details VARCHAR(255)); CREATE TABLE Student_Enrolment (student_enrolment_id INTEGER, degree_program_id INTEGER, semester_id INTEGER, student_id INTEGER, other_details VARCHAR(255)); CREATE TABLE Student_Enrolment_Courses (student_course_id INTEGER, course_id INTEGER, student_enrolment_id INTEGER); CREATE TABLE Transcripts (transcript_id INTEGER, transcript_date DATETIME, other_details VARCHAR(255)); CREATE TABLE Transcript_Contents (student_course_id INTEGER, transcript_id INTEGER);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) ); QUESTION: How many courses in total are listed?
student_transcripts_tracking
SELECT course_description FROM Courses WHERE course_name = 'math'
How is the math course described?
CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) );
CREATE TABLE Addresses (address_id INTEGER, line_1 VARCHAR(255), line_2 VARCHAR(255), line_3 VARCHAR(255), city VARCHAR(255), zip_postcode VARCHAR(20), state_province_county VARCHAR(255), country VARCHAR(255), other_address_details VARCHAR(255)); CREATE TABLE Courses (course_id INTEGER, course_name VARCHAR(255), course_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Departments (department_id INTEGER, department_name VARCHAR(255), department_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Degree_Programs (degree_program_id INTEGER, department_id INTEGER, degree_summary_name VARCHAR(255), degree_summary_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Sections (section_id INTEGER, course_id INTEGER, section_name VARCHAR(255), section_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Semesters (semester_id INTEGER, semester_name VARCHAR(255), semester_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Students (student_id INTEGER, current_address_id INTEGER, permanent_address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(40), last_name VARCHAR(40), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), ssn VARCHAR(40), date_first_registered DATETIME, date_left DATETIME, other_student_details VARCHAR(255)); CREATE TABLE Student_Enrolment (student_enrolment_id INTEGER, degree_program_id INTEGER, semester_id INTEGER, student_id INTEGER, other_details VARCHAR(255)); CREATE TABLE Student_Enrolment_Courses (student_course_id INTEGER, course_id INTEGER, student_enrolment_id INTEGER); CREATE TABLE Transcripts (transcript_id INTEGER, transcript_date DATETIME, other_details VARCHAR(255)); CREATE TABLE Transcript_Contents (student_course_id INTEGER, transcript_id INTEGER);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) ); QUESTION: How is the math course described?
student_transcripts_tracking
SELECT zip_postcode FROM Addresses WHERE city = 'Port Chelsea'
What is the zip code of the address in the city Port Chelsea?
CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) );
CREATE TABLE Addresses (address_id INTEGER, line_1 VARCHAR(255), line_2 VARCHAR(255), line_3 VARCHAR(255), city VARCHAR(255), zip_postcode VARCHAR(20), state_province_county VARCHAR(255), country VARCHAR(255), other_address_details VARCHAR(255)); CREATE TABLE Courses (course_id INTEGER, course_name VARCHAR(255), course_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Departments (department_id INTEGER, department_name VARCHAR(255), department_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Degree_Programs (degree_program_id INTEGER, department_id INTEGER, degree_summary_name VARCHAR(255), degree_summary_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Sections (section_id INTEGER, course_id INTEGER, section_name VARCHAR(255), section_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Semesters (semester_id INTEGER, semester_name VARCHAR(255), semester_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Students (student_id INTEGER, current_address_id INTEGER, permanent_address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(40), last_name VARCHAR(40), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), ssn VARCHAR(40), date_first_registered DATETIME, date_left DATETIME, other_student_details VARCHAR(255)); CREATE TABLE Student_Enrolment (student_enrolment_id INTEGER, degree_program_id INTEGER, semester_id INTEGER, student_id INTEGER, other_details VARCHAR(255)); CREATE TABLE Student_Enrolment_Courses (student_course_id INTEGER, course_id INTEGER, student_enrolment_id INTEGER); CREATE TABLE Transcripts (transcript_id INTEGER, transcript_date DATETIME, other_details VARCHAR(255)); CREATE TABLE Transcript_Contents (student_course_id INTEGER, transcript_id INTEGER);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) ); QUESTION: What is the zip code of the address in the city Port Chelsea?
student_transcripts_tracking
SELECT T2.department_name , T1.department_id FROM Degree_Programs AS T1 JOIN Departments AS T2 ON T1.department_id = T2.department_id GROUP BY T1.department_id ORDER BY count(*) DESC LIMIT 1
Which department offers the most number of degrees? List department name and id.
CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) );
CREATE TABLE Addresses (address_id INTEGER, line_1 VARCHAR(255), line_2 VARCHAR(255), line_3 VARCHAR(255), city VARCHAR(255), zip_postcode VARCHAR(20), state_province_county VARCHAR(255), country VARCHAR(255), other_address_details VARCHAR(255)); CREATE TABLE Courses (course_id INTEGER, course_name VARCHAR(255), course_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Departments (department_id INTEGER, department_name VARCHAR(255), department_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Degree_Programs (degree_program_id INTEGER, department_id INTEGER, degree_summary_name VARCHAR(255), degree_summary_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Sections (section_id INTEGER, course_id INTEGER, section_name VARCHAR(255), section_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Semesters (semester_id INTEGER, semester_name VARCHAR(255), semester_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Students (student_id INTEGER, current_address_id INTEGER, permanent_address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(40), last_name VARCHAR(40), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), ssn VARCHAR(40), date_first_registered DATETIME, date_left DATETIME, other_student_details VARCHAR(255)); CREATE TABLE Student_Enrolment (student_enrolment_id INTEGER, degree_program_id INTEGER, semester_id INTEGER, student_id INTEGER, other_details VARCHAR(255)); CREATE TABLE Student_Enrolment_Courses (student_course_id INTEGER, course_id INTEGER, student_enrolment_id INTEGER); CREATE TABLE Transcripts (transcript_id INTEGER, transcript_date DATETIME, other_details VARCHAR(255)); CREATE TABLE Transcript_Contents (student_course_id INTEGER, transcript_id INTEGER);
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) ); QUESTION: Which department offers the most number of degrees? List department name and id.
student_transcripts_tracking
select t2.department_name , t1.department_id from degree_programs as t1 join departments as t2 on t1.department_id = t2.department_id group by t1.department_id order by count(*) desc limit 1
What is the name and id of the department with the most number of degrees ?
CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) );
CREATE TABLE Addresses (address_id INTEGER, line_1 VARCHAR(255), line_2 VARCHAR(255), line_3 VARCHAR(255), city VARCHAR(255), zip_postcode VARCHAR(20), state_province_county VARCHAR(255), country VARCHAR(255), other_address_details VARCHAR(255)); CREATE TABLE Courses (course_id INTEGER, course_name VARCHAR(255), course_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Departments (department_id INTEGER, department_name VARCHAR(255), department_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Degree_Programs (degree_program_id INTEGER, department_id INTEGER, degree_summary_name VARCHAR(255), degree_summary_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Sections (section_id INTEGER, course_id INTEGER, section_name VARCHAR(255), section_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Semesters (semester_id INTEGER, semester_name VARCHAR(255), semester_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Students (student_id INTEGER, current_address_id INTEGER, permanent_address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(40), last_name VARCHAR(40), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), ssn VARCHAR(40), date_first_registered DATETIME, date_left DATETIME, other_student_details VARCHAR(255)); CREATE TABLE Student_Enrolment (student_enrolment_id INTEGER, degree_program_id INTEGER, semester_id INTEGER, student_id INTEGER, other_details VARCHAR(255)); CREATE TABLE Student_Enrolment_Courses (student_course_id INTEGER, course_id INTEGER, student_enrolment_id INTEGER); CREATE TABLE Transcripts (transcript_id INTEGER, transcript_date DATETIME, other_details VARCHAR(255)); CREATE TABLE Transcript_Contents (student_course_id INTEGER, transcript_id INTEGER);
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) ); QUESTION: What is the name and id of the department with the most number of degrees ?
student_transcripts_tracking
SELECT count(*) FROM Departments AS T1 JOIN Degree_Programs AS T2 ON T1.department_id = T2.department_id WHERE T1.department_name = 'engineer'
How many degrees does the engineering department offer?
CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) );
CREATE TABLE Addresses (address_id INTEGER, line_1 VARCHAR(255), line_2 VARCHAR(255), line_3 VARCHAR(255), city VARCHAR(255), zip_postcode VARCHAR(20), state_province_county VARCHAR(255), country VARCHAR(255), other_address_details VARCHAR(255)); CREATE TABLE Courses (course_id INTEGER, course_name VARCHAR(255), course_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Departments (department_id INTEGER, department_name VARCHAR(255), department_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Degree_Programs (degree_program_id INTEGER, department_id INTEGER, degree_summary_name VARCHAR(255), degree_summary_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Sections (section_id INTEGER, course_id INTEGER, section_name VARCHAR(255), section_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Semesters (semester_id INTEGER, semester_name VARCHAR(255), semester_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Students (student_id INTEGER, current_address_id INTEGER, permanent_address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(40), last_name VARCHAR(40), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), ssn VARCHAR(40), date_first_registered DATETIME, date_left DATETIME, other_student_details VARCHAR(255)); CREATE TABLE Student_Enrolment (student_enrolment_id INTEGER, degree_program_id INTEGER, semester_id INTEGER, student_id INTEGER, other_details VARCHAR(255)); CREATE TABLE Student_Enrolment_Courses (student_course_id INTEGER, course_id INTEGER, student_enrolment_id INTEGER); CREATE TABLE Transcripts (transcript_id INTEGER, transcript_date DATETIME, other_details VARCHAR(255)); CREATE TABLE Transcript_Contents (student_course_id INTEGER, transcript_id INTEGER);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) ); QUESTION: How many degrees does the engineering department offer?
student_transcripts_tracking
SELECT section_name , section_description FROM Sections
What are the names and descriptions of all the sections?
CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) );
CREATE TABLE Addresses (address_id INTEGER, line_1 VARCHAR(255), line_2 VARCHAR(255), line_3 VARCHAR(255), city VARCHAR(255), zip_postcode VARCHAR(20), state_province_county VARCHAR(255), country VARCHAR(255), other_address_details VARCHAR(255)); CREATE TABLE Courses (course_id INTEGER, course_name VARCHAR(255), course_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Departments (department_id INTEGER, department_name VARCHAR(255), department_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Degree_Programs (degree_program_id INTEGER, department_id INTEGER, degree_summary_name VARCHAR(255), degree_summary_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Sections (section_id INTEGER, course_id INTEGER, section_name VARCHAR(255), section_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Semesters (semester_id INTEGER, semester_name VARCHAR(255), semester_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Students (student_id INTEGER, current_address_id INTEGER, permanent_address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(40), last_name VARCHAR(40), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), ssn VARCHAR(40), date_first_registered DATETIME, date_left DATETIME, other_student_details VARCHAR(255)); CREATE TABLE Student_Enrolment (student_enrolment_id INTEGER, degree_program_id INTEGER, semester_id INTEGER, student_id INTEGER, other_details VARCHAR(255)); CREATE TABLE Student_Enrolment_Courses (student_course_id INTEGER, course_id INTEGER, student_enrolment_id INTEGER); CREATE TABLE Transcripts (transcript_id INTEGER, transcript_date DATETIME, other_details VARCHAR(255)); CREATE TABLE Transcript_Contents (student_course_id INTEGER, transcript_id INTEGER);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) ); QUESTION: What are the names and descriptions of all the sections?
student_transcripts_tracking
SELECT T1.semester_name , T1.semester_id FROM Semesters AS T1 JOIN Student_Enrolment AS T2 ON T1.semester_id = T2.semester_id GROUP BY T1.semester_id ORDER BY count(*) DESC LIMIT 1
What is the semester which most student registered in? Show both the name and the id.
CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) );
CREATE TABLE Addresses (address_id INTEGER, line_1 VARCHAR(255), line_2 VARCHAR(255), line_3 VARCHAR(255), city VARCHAR(255), zip_postcode VARCHAR(20), state_province_county VARCHAR(255), country VARCHAR(255), other_address_details VARCHAR(255)); CREATE TABLE Courses (course_id INTEGER, course_name VARCHAR(255), course_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Departments (department_id INTEGER, department_name VARCHAR(255), department_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Degree_Programs (degree_program_id INTEGER, department_id INTEGER, degree_summary_name VARCHAR(255), degree_summary_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Sections (section_id INTEGER, course_id INTEGER, section_name VARCHAR(255), section_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Semesters (semester_id INTEGER, semester_name VARCHAR(255), semester_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Students (student_id INTEGER, current_address_id INTEGER, permanent_address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(40), last_name VARCHAR(40), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), ssn VARCHAR(40), date_first_registered DATETIME, date_left DATETIME, other_student_details VARCHAR(255)); CREATE TABLE Student_Enrolment (student_enrolment_id INTEGER, degree_program_id INTEGER, semester_id INTEGER, student_id INTEGER, other_details VARCHAR(255)); CREATE TABLE Student_Enrolment_Courses (student_course_id INTEGER, course_id INTEGER, student_enrolment_id INTEGER); CREATE TABLE Transcripts (transcript_id INTEGER, transcript_date DATETIME, other_details VARCHAR(255)); CREATE TABLE Transcript_Contents (student_course_id INTEGER, transcript_id INTEGER);
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) ); QUESTION: What is the semester which most student registered in? Show both the name and the id.
student_transcripts_tracking
SELECT DISTINCT T1.first_name , T1.middle_name , T1.last_name FROM Students AS T1 JOIN Student_Enrolment AS T2 ON T1.student_id = T2.student_id JOIN Degree_Programs AS T3 ON T2.degree_program_id = T3.degree_program_id WHERE T3.degree_summary_name = 'Bachelor'
Who is enrolled in a Bachelor degree program? List the first name, middle name, last name.
CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) );
CREATE TABLE Addresses (address_id INTEGER, line_1 VARCHAR(255), line_2 VARCHAR(255), line_3 VARCHAR(255), city VARCHAR(255), zip_postcode VARCHAR(20), state_province_county VARCHAR(255), country VARCHAR(255), other_address_details VARCHAR(255)); CREATE TABLE Courses (course_id INTEGER, course_name VARCHAR(255), course_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Departments (department_id INTEGER, department_name VARCHAR(255), department_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Degree_Programs (degree_program_id INTEGER, department_id INTEGER, degree_summary_name VARCHAR(255), degree_summary_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Sections (section_id INTEGER, course_id INTEGER, section_name VARCHAR(255), section_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Semesters (semester_id INTEGER, semester_name VARCHAR(255), semester_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Students (student_id INTEGER, current_address_id INTEGER, permanent_address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(40), last_name VARCHAR(40), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), ssn VARCHAR(40), date_first_registered DATETIME, date_left DATETIME, other_student_details VARCHAR(255)); CREATE TABLE Student_Enrolment (student_enrolment_id INTEGER, degree_program_id INTEGER, semester_id INTEGER, student_id INTEGER, other_details VARCHAR(255)); CREATE TABLE Student_Enrolment_Courses (student_course_id INTEGER, course_id INTEGER, student_enrolment_id INTEGER); CREATE TABLE Transcripts (transcript_id INTEGER, transcript_date DATETIME, other_details VARCHAR(255)); CREATE TABLE Transcript_Contents (student_course_id INTEGER, transcript_id INTEGER);
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) ); QUESTION: Who is enrolled in a Bachelor degree program? List the first name, middle name, last name.
student_transcripts_tracking
SELECT semester_name FROM Semesters WHERE semester_id NOT IN( SELECT semester_id FROM Student_Enrolment )
Which semesters do not have any student enrolled? List the semester name.
CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) );
CREATE TABLE Addresses (address_id INTEGER, line_1 VARCHAR(255), line_2 VARCHAR(255), line_3 VARCHAR(255), city VARCHAR(255), zip_postcode VARCHAR(20), state_province_county VARCHAR(255), country VARCHAR(255), other_address_details VARCHAR(255)); CREATE TABLE Courses (course_id INTEGER, course_name VARCHAR(255), course_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Departments (department_id INTEGER, department_name VARCHAR(255), department_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Degree_Programs (degree_program_id INTEGER, department_id INTEGER, degree_summary_name VARCHAR(255), degree_summary_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Sections (section_id INTEGER, course_id INTEGER, section_name VARCHAR(255), section_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Semesters (semester_id INTEGER, semester_name VARCHAR(255), semester_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Students (student_id INTEGER, current_address_id INTEGER, permanent_address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(40), last_name VARCHAR(40), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), ssn VARCHAR(40), date_first_registered DATETIME, date_left DATETIME, other_student_details VARCHAR(255)); CREATE TABLE Student_Enrolment (student_enrolment_id INTEGER, degree_program_id INTEGER, semester_id INTEGER, student_id INTEGER, other_details VARCHAR(255)); CREATE TABLE Student_Enrolment_Courses (student_course_id INTEGER, course_id INTEGER, student_enrolment_id INTEGER); CREATE TABLE Transcripts (transcript_id INTEGER, transcript_date DATETIME, other_details VARCHAR(255)); CREATE TABLE Transcript_Contents (student_course_id INTEGER, transcript_id INTEGER);
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) ); QUESTION: Which semesters do not have any student enrolled? List the semester name.
student_transcripts_tracking
SELECT count(*) , student_course_id FROM Transcript_Contents GROUP BY student_course_id ORDER BY count(*) DESC LIMIT 1
How many times at most can a course enrollment result show in different transcripts? Also show the course enrollment id.
CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) );
CREATE TABLE Addresses (address_id INTEGER, line_1 VARCHAR(255), line_2 VARCHAR(255), line_3 VARCHAR(255), city VARCHAR(255), zip_postcode VARCHAR(20), state_province_county VARCHAR(255), country VARCHAR(255), other_address_details VARCHAR(255)); CREATE TABLE Courses (course_id INTEGER, course_name VARCHAR(255), course_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Departments (department_id INTEGER, department_name VARCHAR(255), department_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Degree_Programs (degree_program_id INTEGER, department_id INTEGER, degree_summary_name VARCHAR(255), degree_summary_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Sections (section_id INTEGER, course_id INTEGER, section_name VARCHAR(255), section_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Semesters (semester_id INTEGER, semester_name VARCHAR(255), semester_description VARCHAR(255), other_details VARCHAR(255)); CREATE TABLE Students (student_id INTEGER, current_address_id INTEGER, permanent_address_id INTEGER, first_name VARCHAR(80), middle_name VARCHAR(40), last_name VARCHAR(40), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), ssn VARCHAR(40), date_first_registered DATETIME, date_left DATETIME, other_student_details VARCHAR(255)); CREATE TABLE Student_Enrolment (student_enrolment_id INTEGER, degree_program_id INTEGER, semester_id INTEGER, student_id INTEGER, other_details VARCHAR(255)); CREATE TABLE Student_Enrolment_Courses (student_course_id INTEGER, course_id INTEGER, student_enrolment_id INTEGER); CREATE TABLE Transcripts (transcript_id INTEGER, transcript_date DATETIME, other_details VARCHAR(255)); CREATE TABLE Transcript_Contents (student_course_id INTEGER, transcript_id INTEGER);
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Addresses` ( `address_id` INTEGER PRIMARY KEY, `line_1` VARCHAR(255), `line_2` VARCHAR(255), `line_3` VARCHAR(255), `city` VARCHAR(255), `zip_postcode` VARCHAR(20), `state_province_county` VARCHAR(255), `country` VARCHAR(255), `other_address_details` VARCHAR(255) ); CREATE TABLE `Courses` ( `course_id` INTEGER PRIMARY KEY, `course_name` VARCHAR(255), `course_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Departments` ( `department_id` INTEGER PRIMARY KEY, `department_name` VARCHAR(255), `department_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Degree_Programs` ( `degree_program_id` INTEGER PRIMARY KEY, `department_id` INTEGER NOT NULL, `degree_summary_name` VARCHAR(255), `degree_summary_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ) ); CREATE TABLE `Sections` ( `section_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `section_name` VARCHAR(255), `section_description` VARCHAR(255), `other_details` VARCHAR(255), FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ) ); CREATE TABLE `Semesters` ( `semester_id` INTEGER PRIMARY KEY, `semester_name` VARCHAR(255), `semester_description` VARCHAR(255), `other_details` VARCHAR(255) ); CREATE TABLE `Students` ( `student_id` INTEGER PRIMARY KEY, `current_address_id` INTEGER NOT NULL, `permanent_address_id` INTEGER NOT NULL, `first_name` VARCHAR(80), `middle_name` VARCHAR(40), `last_name` VARCHAR(40), `cell_mobile_number` VARCHAR(40), `email_address` VARCHAR(40), `ssn` VARCHAR(40), `date_first_registered` DATETIME, `date_left` DATETIME, `other_student_details` VARCHAR(255), FOREIGN KEY (`current_address_id` ) REFERENCES `Addresses`(`address_id` ), FOREIGN KEY (`permanent_address_id` ) REFERENCES `Addresses`(`address_id` ) ); CREATE TABLE `Student_Enrolment` ( `student_enrolment_id` INTEGER PRIMARY KEY, `degree_program_id` INTEGER NOT NULL, `semester_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `other_details` VARCHAR(255), FOREIGN KEY (`degree_program_id` ) REFERENCES `Degree_Programs`(`degree_program_id` ), FOREIGN KEY (`semester_id` ) REFERENCES `Semesters`(`semester_id` ), FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ) ); CREATE TABLE `Student_Enrolment_Courses` ( `student_course_id` INTEGER PRIMARY KEY, `course_id` INTEGER NOT NULL, `student_enrolment_id` INTEGER NOT NULL, FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ), FOREIGN KEY (`student_enrolment_id` ) REFERENCES `Student_Enrolment`(`student_enrolment_id` ) ); CREATE TABLE `Transcripts` ( `transcript_id` INTEGER PRIMARY KEY, `transcript_date` DATETIME, `other_details` VARCHAR(255) ); CREATE TABLE `Transcript_Contents` ( `student_course_id` INTEGER NOT NULL, `transcript_id` INTEGER NOT NULL, FOREIGN KEY (`student_course_id` ) REFERENCES `Student_Enrolment_Courses`(`student_course_id` ), FOREIGN KEY (`transcript_id` ) REFERENCES `Transcripts`(`transcript_id` ) ); QUESTION: How many times at most can a course enrollment result show in different transcripts? Also show the course enrollment id.
tvshow
SELECT Title FROM Cartoon ORDER BY title
List the title of all cartoons in alphabetical order.
CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) );
CREATE TABLE TV_Channel (id TEXT, series_name TEXT, Country TEXT, Language TEXT, Content TEXT, Pixel_aspect_ratio_PAR TEXT, Hight_definition_TV TEXT, Pay_per_view_PPV TEXT, Package_Option TEXT); CREATE TABLE TV_series (id REAL, Episode TEXT, Air_Date TEXT, Rating TEXT, Share REAL, 18_49_Rating_Share TEXT, Viewers_m TEXT, Weekly_Rank REAL, Channel TEXT); CREATE TABLE Cartoon (id REAL, Title TEXT, Directed_by TEXT, Written_by TEXT, Original_air_date TEXT, Production_code REAL, Channel TEXT);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); QUESTION: List the title of all cartoons in alphabetical order.
tvshow
SELECT Title FROM Cartoon WHERE Directed_by = "Ben Jones";
List all cartoon directed by "Ben Jones".
CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) );
CREATE TABLE TV_Channel (id TEXT, series_name TEXT, Country TEXT, Language TEXT, Content TEXT, Pixel_aspect_ratio_PAR TEXT, Hight_definition_TV TEXT, Pay_per_view_PPV TEXT, Package_Option TEXT); CREATE TABLE TV_series (id REAL, Episode TEXT, Air_Date TEXT, Rating TEXT, Share REAL, 18_49_Rating_Share TEXT, Viewers_m TEXT, Weekly_Rank REAL, Channel TEXT); CREATE TABLE Cartoon (id REAL, Title TEXT, Directed_by TEXT, Written_by TEXT, Original_air_date TEXT, Production_code REAL, Channel TEXT);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); QUESTION: List all cartoon directed by "Ben Jones".
tvshow
SELECT count(*) FROM Cartoon WHERE Written_by = "Joseph Kuhr";
How many cartoons were written by "Joseph Kuhr"?
CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) );
CREATE TABLE TV_Channel (id TEXT, series_name TEXT, Country TEXT, Language TEXT, Content TEXT, Pixel_aspect_ratio_PAR TEXT, Hight_definition_TV TEXT, Pay_per_view_PPV TEXT, Package_Option TEXT); CREATE TABLE TV_series (id REAL, Episode TEXT, Air_Date TEXT, Rating TEXT, Share REAL, 18_49_Rating_Share TEXT, Viewers_m TEXT, Weekly_Rank REAL, Channel TEXT); CREATE TABLE Cartoon (id REAL, Title TEXT, Directed_by TEXT, Written_by TEXT, Original_air_date TEXT, Production_code REAL, Channel TEXT);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); QUESTION: How many cartoons were written by "Joseph Kuhr"?
tvshow
SELECT title , Directed_by FROM Cartoon ORDER BY Original_air_date
list all cartoon titles and their directors ordered by their air date
CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) );
CREATE TABLE TV_Channel (id TEXT, series_name TEXT, Country TEXT, Language TEXT, Content TEXT, Pixel_aspect_ratio_PAR TEXT, Hight_definition_TV TEXT, Pay_per_view_PPV TEXT, Package_Option TEXT); CREATE TABLE TV_series (id REAL, Episode TEXT, Air_Date TEXT, Rating TEXT, Share REAL, 18_49_Rating_Share TEXT, Viewers_m TEXT, Weekly_Rank REAL, Channel TEXT); CREATE TABLE Cartoon (id REAL, Title TEXT, Directed_by TEXT, Written_by TEXT, Original_air_date TEXT, Production_code REAL, Channel TEXT);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); QUESTION: list all cartoon titles and their directors ordered by their air date
tvshow
SELECT Title FROM Cartoon WHERE Directed_by = "Ben Jones" OR Directed_by = "Brandon Vietti";
List the title of all cartoon directed by "Ben Jones" or "Brandon Vietti".
CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) );
CREATE TABLE TV_Channel (id TEXT, series_name TEXT, Country TEXT, Language TEXT, Content TEXT, Pixel_aspect_ratio_PAR TEXT, Hight_definition_TV TEXT, Pay_per_view_PPV TEXT, Package_Option TEXT); CREATE TABLE TV_series (id REAL, Episode TEXT, Air_Date TEXT, Rating TEXT, Share REAL, 18_49_Rating_Share TEXT, Viewers_m TEXT, Weekly_Rank REAL, Channel TEXT); CREATE TABLE Cartoon (id REAL, Title TEXT, Directed_by TEXT, Written_by TEXT, Original_air_date TEXT, Production_code REAL, Channel TEXT);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); QUESTION: List the title of all cartoon directed by "Ben Jones" or "Brandon Vietti".
tvshow
SELECT Country , count(*) FROM TV_Channel GROUP BY Country ORDER BY count(*) DESC LIMIT 1;
Which country has the most of TV Channels? List the country and number of TV Channels it has.
CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) );
CREATE TABLE TV_Channel (id TEXT, series_name TEXT, Country TEXT, Language TEXT, Content TEXT, Pixel_aspect_ratio_PAR TEXT, Hight_definition_TV TEXT, Pay_per_view_PPV TEXT, Package_Option TEXT); CREATE TABLE TV_series (id REAL, Episode TEXT, Air_Date TEXT, Rating TEXT, Share REAL, 18_49_Rating_Share TEXT, Viewers_m TEXT, Weekly_Rank REAL, Channel TEXT); CREATE TABLE Cartoon (id REAL, Title TEXT, Directed_by TEXT, Written_by TEXT, Original_air_date TEXT, Production_code REAL, Channel TEXT);
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); QUESTION: Which country has the most of TV Channels? List the country and number of TV Channels it has.
tvshow
SELECT count(DISTINCT series_name) , count(DISTINCT content) FROM TV_Channel;
List the number of different series names and contents in the TV Channel table.
CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) );
CREATE TABLE TV_Channel (id TEXT, series_name TEXT, Country TEXT, Language TEXT, Content TEXT, Pixel_aspect_ratio_PAR TEXT, Hight_definition_TV TEXT, Pay_per_view_PPV TEXT, Package_Option TEXT); CREATE TABLE TV_series (id REAL, Episode TEXT, Air_Date TEXT, Rating TEXT, Share REAL, 18_49_Rating_Share TEXT, Viewers_m TEXT, Weekly_Rank REAL, Channel TEXT); CREATE TABLE Cartoon (id REAL, Title TEXT, Directed_by TEXT, Written_by TEXT, Original_air_date TEXT, Production_code REAL, Channel TEXT);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); QUESTION: List the number of different series names and contents in the TV Channel table.
tvshow
SELECT LANGUAGE , count(*) FROM TV_Channel GROUP BY LANGUAGE ORDER BY count(*) ASC LIMIT 1;
List the language used least number of TV Channel. List language and number of TV Channel.
CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) );
CREATE TABLE TV_Channel (id TEXT, series_name TEXT, Country TEXT, Language TEXT, Content TEXT, Pixel_aspect_ratio_PAR TEXT, Hight_definition_TV TEXT, Pay_per_view_PPV TEXT, Package_Option TEXT); CREATE TABLE TV_series (id REAL, Episode TEXT, Air_Date TEXT, Rating TEXT, Share REAL, 18_49_Rating_Share TEXT, Viewers_m TEXT, Weekly_Rank REAL, Channel TEXT); CREATE TABLE Cartoon (id REAL, Title TEXT, Directed_by TEXT, Written_by TEXT, Original_air_date TEXT, Production_code REAL, Channel TEXT);
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); QUESTION: List the language used least number of TV Channel. List language and number of TV Channel.
tvshow
SELECT country FROM TV_Channel EXCEPT SELECT T1.country FROM TV_Channel AS T1 JOIN cartoon AS T2 ON T1.id = T2.Channel WHERE T2.written_by = 'Todd Casey'
which countries' tv channels are not playing any cartoon written by Todd Casey?
CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) );
CREATE TABLE TV_Channel (id TEXT, series_name TEXT, Country TEXT, Language TEXT, Content TEXT, Pixel_aspect_ratio_PAR TEXT, Hight_definition_TV TEXT, Pay_per_view_PPV TEXT, Package_Option TEXT); CREATE TABLE TV_series (id REAL, Episode TEXT, Air_Date TEXT, Rating TEXT, Share REAL, 18_49_Rating_Share TEXT, Viewers_m TEXT, Weekly_Rank REAL, Channel TEXT); CREATE TABLE Cartoon (id REAL, Title TEXT, Directed_by TEXT, Written_by TEXT, Original_air_date TEXT, Production_code REAL, Channel TEXT);
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); QUESTION: which countries' tv channels are not playing any cartoon written by Todd Casey?
tvshow
SELECT T1.series_name , T1.country FROM TV_Channel AS T1 JOIN cartoon AS T2 ON T1.id = T2.Channel WHERE T2.directed_by = 'Michael Chang' INTERSECT SELECT T1.series_name , T1.country FROM TV_Channel AS T1 JOIN cartoon AS T2 ON T1.id = T2.Channel WHERE T2.directed_by = 'Ben Jones'
Find the series name and country of the tv channel that is playing some cartoons directed by Ben Jones and Michael Chang?
CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) );
CREATE TABLE TV_Channel (id TEXT, series_name TEXT, Country TEXT, Language TEXT, Content TEXT, Pixel_aspect_ratio_PAR TEXT, Hight_definition_TV TEXT, Pay_per_view_PPV TEXT, Package_Option TEXT); CREATE TABLE TV_series (id REAL, Episode TEXT, Air_Date TEXT, Rating TEXT, Share REAL, 18_49_Rating_Share TEXT, Viewers_m TEXT, Weekly_Rank REAL, Channel TEXT); CREATE TABLE Cartoon (id REAL, Title TEXT, Directed_by TEXT, Written_by TEXT, Original_air_date TEXT, Production_code REAL, Channel TEXT);
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE IF NOT EXISTS "TV_Channel" ( "id" text, "series_name" text, "Country" text, "Language" text, "Content" text, "Pixel_aspect_ratio_PAR" text, "Hight_definition_TV" text, "Pay_per_view_PPV" text, "Package_Option" text, PRIMARY KEY ("id") ); CREATE TABLE IF NOT EXISTS "TV_series" ( "id" real, "Episode" text, "Air_Date" text, "Rating" text, "Share" real, "18_49_Rating_Share" text, "Viewers_m" text, "Weekly_Rank" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); CREATE TABLE IF NOT EXISTS "Cartoon" ( "id" real, "Title" text, "Directed_by" text, "Written_by" text, "Original_air_date" text, "Production_code" real, "Channel" text, PRIMARY KEY ("id"), FOREIGN KEY (`Channel`) REFERENCES `TV_Channel`(`id`) ); QUESTION: Find the series name and country of the tv channel that is playing some cartoons directed by Ben Jones and Michael Chang?
poker_player
SELECT count(*) FROM poker_player
How many poker players are there?
CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") );
CREATE TABLE poker_player (Poker_Player_ID INT, People_ID INT, Final_Table_Made REAL, Best_Finish REAL, Money_Rank REAL, Earnings REAL); CREATE TABLE people (People_ID INT, Nationality TEXT, Name TEXT, Birth_Date TEXT, Height REAL);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") ); QUESTION: How many poker players are there?
poker_player
SELECT Earnings FROM poker_player ORDER BY Earnings DESC
List the earnings of poker players in descending order.
CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") );
CREATE TABLE poker_player (Poker_Player_ID INT, People_ID INT, Final_Table_Made REAL, Best_Finish REAL, Money_Rank REAL, Earnings REAL); CREATE TABLE people (People_ID INT, Nationality TEXT, Name TEXT, Birth_Date TEXT, Height REAL);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") ); QUESTION: List the earnings of poker players in descending order.
poker_player
SELECT Final_Table_Made , Best_Finish FROM poker_player
List the final tables made and the best finishes of poker players.
CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") );
CREATE TABLE poker_player (Poker_Player_ID INT, People_ID INT, Final_Table_Made REAL, Best_Finish REAL, Money_Rank REAL, Earnings REAL); CREATE TABLE people (People_ID INT, Nationality TEXT, Name TEXT, Birth_Date TEXT, Height REAL);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") ); QUESTION: List the final tables made and the best finishes of poker players.
poker_player
SELECT avg(Earnings) FROM poker_player
What is the average earnings of poker players?
CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") );
CREATE TABLE poker_player (Poker_Player_ID INT, People_ID INT, Final_Table_Made REAL, Best_Finish REAL, Money_Rank REAL, Earnings REAL); CREATE TABLE people (People_ID INT, Nationality TEXT, Name TEXT, Birth_Date TEXT, Height REAL);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") ); QUESTION: What is the average earnings of poker players?
poker_player
SELECT Money_Rank FROM poker_player ORDER BY Earnings DESC LIMIT 1
What is the money rank of the poker player with the highest earnings?
CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") );
CREATE TABLE poker_player (Poker_Player_ID INT, People_ID INT, Final_Table_Made REAL, Best_Finish REAL, Money_Rank REAL, Earnings REAL); CREATE TABLE people (People_ID INT, Nationality TEXT, Name TEXT, Birth_Date TEXT, Height REAL);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") ); QUESTION: What is the money rank of the poker player with the highest earnings?
poker_player
SELECT T1.Name FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Earnings > 300000
What are the names of poker players whose earnings is higher than 300000?
CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") );
CREATE TABLE poker_player (Poker_Player_ID INT, People_ID INT, Final_Table_Made REAL, Best_Finish REAL, Money_Rank REAL, Earnings REAL); CREATE TABLE people (People_ID INT, Nationality TEXT, Name TEXT, Birth_Date TEXT, Height REAL);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") ); QUESTION: What are the names of poker players whose earnings is higher than 300000?
poker_player
SELECT T1.Birth_Date FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Earnings ASC LIMIT 1
What is the birth date of the poker player with the lowest earnings?
CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") );
CREATE TABLE poker_player (Poker_Player_ID INT, People_ID INT, Final_Table_Made REAL, Best_Finish REAL, Money_Rank REAL, Earnings REAL); CREATE TABLE people (People_ID INT, Nationality TEXT, Name TEXT, Birth_Date TEXT, Height REAL);
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") ); QUESTION: What is the birth date of the poker player with the lowest earnings?
poker_player
SELECT T2.Money_Rank FROM people AS T1 JOIN poker_player AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Height DESC LIMIT 1
What is the money rank of the tallest poker player?
CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") );
CREATE TABLE poker_player (Poker_Player_ID INT, People_ID INT, Final_Table_Made REAL, Best_Finish REAL, Money_Rank REAL, Earnings REAL); CREATE TABLE people (People_ID INT, Nationality TEXT, Name TEXT, Birth_Date TEXT, Height REAL);
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") ); QUESTION: What is the money rank of the tallest poker player?
poker_player
SELECT Nationality FROM people GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
What is the most common nationality of people?
CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") );
CREATE TABLE poker_player (Poker_Player_ID INT, People_ID INT, Final_Table_Made REAL, Best_Finish REAL, Money_Rank REAL, Earnings REAL); CREATE TABLE people (People_ID INT, Nationality TEXT, Name TEXT, Birth_Date TEXT, Height REAL);
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "poker_player" ( "Poker_Player_ID" int, "People_ID" int, "Final_Table_Made" real, "Best_Finish" real, "Money_Rank" real, "Earnings" real, PRIMARY KEY ("Poker_Player_ID"), FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID") ); CREATE TABLE "people" ( "People_ID" int, "Nationality" text, "Name" text, "Birth_Date" text, "Height" real, PRIMARY KEY ("People_ID") ); QUESTION: What is the most common nationality of people?
voter_1
SELECT count(*) FROM area_code_state
How many states are there?
CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") );
CREATE TABLE AREA_CODE_STATE (area_code INTEGER, state varchar(2)); CREATE TABLE CONTESTANTS (contestant_number INTEGER, contestant_name varchar(50)); CREATE TABLE VOTES (vote_id INTEGER, phone_number INTEGER, state varchar(2), contestant_number INTEGER, created timestamp);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") ); QUESTION: How many states are there?
voter_1
SELECT contestant_number , contestant_name FROM contestants ORDER BY contestant_name DESC
List the contestant numbers and names, ordered by contestant name descending.
CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") );
CREATE TABLE AREA_CODE_STATE (area_code INTEGER, state varchar(2)); CREATE TABLE CONTESTANTS (contestant_number INTEGER, contestant_name varchar(50)); CREATE TABLE VOTES (vote_id INTEGER, phone_number INTEGER, state varchar(2), contestant_number INTEGER, created timestamp);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") ); QUESTION: List the contestant numbers and names, ordered by contestant name descending.
voter_1
SELECT vote_id , phone_number , state FROM votes
List the vote ids, phone numbers and states of all votes.
CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") );
CREATE TABLE AREA_CODE_STATE (area_code INTEGER, state varchar(2)); CREATE TABLE CONTESTANTS (contestant_number INTEGER, contestant_name varchar(50)); CREATE TABLE VOTES (vote_id INTEGER, phone_number INTEGER, state varchar(2), contestant_number INTEGER, created timestamp);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") ); QUESTION: List the vote ids, phone numbers and states of all votes.
voter_1
SELECT max(area_code) , min(area_code) FROM area_code_state
What are the maximum and minimum values of area codes?
CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") );
CREATE TABLE AREA_CODE_STATE (area_code INTEGER, state varchar(2)); CREATE TABLE CONTESTANTS (contestant_number INTEGER, contestant_name varchar(50)); CREATE TABLE VOTES (vote_id INTEGER, phone_number INTEGER, state varchar(2), contestant_number INTEGER, created timestamp);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") ); QUESTION: What are the maximum and minimum values of area codes?
voter_1
SELECT max(created) FROM votes WHERE state = 'CA'
What is last date created of votes from the state 'CA'?
CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") );
CREATE TABLE AREA_CODE_STATE (area_code INTEGER, state varchar(2)); CREATE TABLE CONTESTANTS (contestant_number INTEGER, contestant_name varchar(50)); CREATE TABLE VOTES (vote_id INTEGER, phone_number INTEGER, state varchar(2), contestant_number INTEGER, created timestamp);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") ); QUESTION: What is last date created of votes from the state 'CA'?
voter_1
SELECT contestant_name FROM contestants WHERE contestant_name != 'Jessie Alloway'
What are the names of the contestants whose names are not 'Jessie Alloway'
CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") );
CREATE TABLE AREA_CODE_STATE (area_code INTEGER, state varchar(2)); CREATE TABLE CONTESTANTS (contestant_number INTEGER, contestant_name varchar(50)); CREATE TABLE VOTES (vote_id INTEGER, phone_number INTEGER, state varchar(2), contestant_number INTEGER, created timestamp);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") ); QUESTION: What are the names of the contestants whose names are not 'Jessie Alloway'
voter_1
SELECT T1.contestant_number , T1.contestant_name FROM contestants AS T1 JOIN votes AS T2 ON T1.contestant_number = T2.contestant_number GROUP BY T1.contestant_number ORDER BY count(*) ASC LIMIT 1
Of all the contestants who got voted, what is the contestant number and name of the contestant who got least votes?
CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") );
CREATE TABLE AREA_CODE_STATE (area_code INTEGER, state varchar(2)); CREATE TABLE CONTESTANTS (contestant_number INTEGER, contestant_name varchar(50)); CREATE TABLE VOTES (vote_id INTEGER, phone_number INTEGER, state varchar(2), contestant_number INTEGER, created timestamp);
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") ); QUESTION: Of all the contestants who got voted, what is the contestant number and name of the contestant who got least votes?
voter_1
SELECT count(*) FROM contestants WHERE contestant_number NOT IN ( SELECT contestant_number FROM votes )
How many contestants did not get voted?
CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") );
CREATE TABLE AREA_CODE_STATE (area_code INTEGER, state varchar(2)); CREATE TABLE CONTESTANTS (contestant_number INTEGER, contestant_name varchar(50)); CREATE TABLE VOTES (vote_id INTEGER, phone_number INTEGER, state varchar(2), contestant_number INTEGER, created timestamp);
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") ); QUESTION: How many contestants did not get voted?
voter_1
SELECT T1.area_code FROM area_code_state AS T1 JOIN votes AS T2 ON T1.state = T2.state GROUP BY T1.area_code ORDER BY count(*) DESC LIMIT 1
What is the area code in which the most voters voted?
CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") );
CREATE TABLE AREA_CODE_STATE (area_code INTEGER, state varchar(2)); CREATE TABLE CONTESTANTS (contestant_number INTEGER, contestant_name varchar(50)); CREATE TABLE VOTES (vote_id INTEGER, phone_number INTEGER, state varchar(2), contestant_number INTEGER, created timestamp);
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "AREA_CODE_STATE" ( "area_code" INTEGER, "state" varchar(2) PRIMARY KEY ("state"), ); CREATE TABLE "CONTESTANTS" ( "contestant_number" INTEGER, "contestant_name" varchar(50) PRIMARY KEY ("contestant_number"), ); CREATE TABLE "VOTES" ( "vote_id" INTEGER, "phone_number" INTEGER, "state" varchar(2), "contestant_number" INTEGER, "created" timestamp PRIMARY KEY ("vote_id"), FOREIGN KEY ("state") REFERENCES "AREA_CODE_STATE"("state"), FOREIGN KEY ("contestant_number") REFERENCES "CONTESTANTS"("contestant_number") ); QUESTION: What is the area code in which the most voters voted?
world_1
SELECT Name FROM country WHERE IndepYear > 1950
What are the names of all the countries that became independent after 1950?
CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") );
CREATE TABLE city (ID INTEGER, Name char(35), CountryCode char(3), District char(20), Population INTEGER); CREATE TABLE sqlite_sequence (name , seq ); CREATE TABLE country (Code char(3), Name char(52), Continent TEXT, Region char(26), SurfaceArea float(10,2), IndepYear INTEGER, Population INTEGER, LifeExpectancy float(3,1), GNP float(10,2), GNPOld float(10,2), LocalName char(45), GovernmentForm char(45), HeadOfState char(60), Capital INTEGER, Code2 char(2)); CREATE TABLE countrylanguage (CountryCode char(3), Language char(30), IsOfficial TEXT, Percentage float(4,1));
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); QUESTION: What are the names of all the countries that became independent after 1950?
world_1
SELECT count(*) FROM country WHERE GovernmentForm = "Republic"
How many countries have a republic as their form of government?
CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") );
CREATE TABLE city (ID INTEGER, Name char(35), CountryCode char(3), District char(20), Population INTEGER); CREATE TABLE sqlite_sequence (name , seq ); CREATE TABLE country (Code char(3), Name char(52), Continent TEXT, Region char(26), SurfaceArea float(10,2), IndepYear INTEGER, Population INTEGER, LifeExpectancy float(3,1), GNP float(10,2), GNPOld float(10,2), LocalName char(45), GovernmentForm char(45), HeadOfState char(60), Capital INTEGER, Code2 char(2)); CREATE TABLE countrylanguage (CountryCode char(3), Language char(30), IsOfficial TEXT, Percentage float(4,1));
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); QUESTION: How many countries have a republic as their form of government?
world_1
SELECT sum(SurfaceArea) FROM country WHERE Region = "Caribbean"
What is the total surface area of the countries in the Caribbean region?
CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") );
CREATE TABLE city (ID INTEGER, Name char(35), CountryCode char(3), District char(20), Population INTEGER); CREATE TABLE sqlite_sequence (name , seq ); CREATE TABLE country (Code char(3), Name char(52), Continent TEXT, Region char(26), SurfaceArea float(10,2), IndepYear INTEGER, Population INTEGER, LifeExpectancy float(3,1), GNP float(10,2), GNPOld float(10,2), LocalName char(45), GovernmentForm char(45), HeadOfState char(60), Capital INTEGER, Code2 char(2)); CREATE TABLE countrylanguage (CountryCode char(3), Language char(30), IsOfficial TEXT, Percentage float(4,1));
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); QUESTION: What is the total surface area of the countries in the Caribbean region?
world_1
SELECT Region FROM country AS T1 JOIN city AS T2 ON T1.Code = T2.CountryCode WHERE T2.Name = "Kabul"
Which region is the city Kabul located in?
CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") );
CREATE TABLE city (ID INTEGER, Name char(35), CountryCode char(3), District char(20), Population INTEGER); CREATE TABLE sqlite_sequence (name , seq ); CREATE TABLE country (Code char(3), Name char(52), Continent TEXT, Region char(26), SurfaceArea float(10,2), IndepYear INTEGER, Population INTEGER, LifeExpectancy float(3,1), GNP float(10,2), GNPOld float(10,2), LocalName char(45), GovernmentForm char(45), HeadOfState char(60), Capital INTEGER, Code2 char(2)); CREATE TABLE countrylanguage (CountryCode char(3), Language char(30), IsOfficial TEXT, Percentage float(4,1));
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); QUESTION: Which region is the city Kabul located in?
world_1
SELECT T2.Language FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.Name = "Aruba" ORDER BY Percentage DESC LIMIT 1
Which language is the most popular in Aruba?
CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") );
CREATE TABLE city (ID INTEGER, Name char(35), CountryCode char(3), District char(20), Population INTEGER); CREATE TABLE sqlite_sequence (name , seq ); CREATE TABLE country (Code char(3), Name char(52), Continent TEXT, Region char(26), SurfaceArea float(10,2), IndepYear INTEGER, Population INTEGER, LifeExpectancy float(3,1), GNP float(10,2), GNPOld float(10,2), LocalName char(45), GovernmentForm char(45), HeadOfState char(60), Capital INTEGER, Code2 char(2)); CREATE TABLE countrylanguage (CountryCode char(3), Language char(30), IsOfficial TEXT, Percentage float(4,1));
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); QUESTION: Which language is the most popular in Aruba?
world_1
SELECT Population , LifeExpectancy FROM country WHERE Name = "Brazil"
What are the population and life expectancies in Brazil?
CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") );
CREATE TABLE city (ID INTEGER, Name char(35), CountryCode char(3), District char(20), Population INTEGER); CREATE TABLE sqlite_sequence (name , seq ); CREATE TABLE country (Code char(3), Name char(52), Continent TEXT, Region char(26), SurfaceArea float(10,2), IndepYear INTEGER, Population INTEGER, LifeExpectancy float(3,1), GNP float(10,2), GNPOld float(10,2), LocalName char(45), GovernmentForm char(45), HeadOfState char(60), Capital INTEGER, Code2 char(2)); CREATE TABLE countrylanguage (CountryCode char(3), Language char(30), IsOfficial TEXT, Percentage float(4,1));
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); QUESTION: What are the population and life expectancies in Brazil?
world_1
SELECT Population , Region FROM country WHERE Name = "Angola"
What are the region and population of Angola?
CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") );
CREATE TABLE city (ID INTEGER, Name char(35), CountryCode char(3), District char(20), Population INTEGER); CREATE TABLE sqlite_sequence (name , seq ); CREATE TABLE country (Code char(3), Name char(52), Continent TEXT, Region char(26), SurfaceArea float(10,2), IndepYear INTEGER, Population INTEGER, LifeExpectancy float(3,1), GNP float(10,2), GNPOld float(10,2), LocalName char(45), GovernmentForm char(45), HeadOfState char(60), Capital INTEGER, Code2 char(2)); CREATE TABLE countrylanguage (CountryCode char(3), Language char(30), IsOfficial TEXT, Percentage float(4,1));
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); QUESTION: What are the region and population of Angola?
world_1
SELECT Name FROM country WHERE Continent = "Asia" ORDER BY LifeExpectancy LIMIT 1
What is the name of country that has the shortest life expectancy in Asia?
CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") );
CREATE TABLE city (ID INTEGER, Name char(35), CountryCode char(3), District char(20), Population INTEGER); CREATE TABLE sqlite_sequence (name , seq ); CREATE TABLE country (Code char(3), Name char(52), Continent TEXT, Region char(26), SurfaceArea float(10,2), IndepYear INTEGER, Population INTEGER, LifeExpectancy float(3,1), GNP float(10,2), GNPOld float(10,2), LocalName char(45), GovernmentForm char(45), HeadOfState char(60), Capital INTEGER, Code2 char(2)); CREATE TABLE countrylanguage (CountryCode char(3), Language char(30), IsOfficial TEXT, Percentage float(4,1));
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); QUESTION: What is the name of country that has the shortest life expectancy in Asia?
world_1
SELECT T1.Name FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode GROUP BY T1.Name ORDER BY COUNT(*) DESC LIMIT 1
What is name of the country that speaks the largest number of languages?
CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") );
CREATE TABLE city (ID INTEGER, Name char(35), CountryCode char(3), District char(20), Population INTEGER); CREATE TABLE sqlite_sequence (name , seq ); CREATE TABLE country (Code char(3), Name char(52), Continent TEXT, Region char(26), SurfaceArea float(10,2), IndepYear INTEGER, Population INTEGER, LifeExpectancy float(3,1), GNP float(10,2), GNPOld float(10,2), LocalName char(45), GovernmentForm char(45), HeadOfState char(60), Capital INTEGER, Code2 char(2)); CREATE TABLE countrylanguage (CountryCode char(3), Language char(30), IsOfficial TEXT, Percentage float(4,1));
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); QUESTION: What is name of the country that speaks the largest number of languages?
world_1
SELECT T1.Continent FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode GROUP BY T1.Continent ORDER BY COUNT(*) DESC LIMIT 1
Which continent has the most diverse languages?
CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") );
CREATE TABLE city (ID INTEGER, Name char(35), CountryCode char(3), District char(20), Population INTEGER); CREATE TABLE sqlite_sequence (name , seq ); CREATE TABLE country (Code char(3), Name char(52), Continent TEXT, Region char(26), SurfaceArea float(10,2), IndepYear INTEGER, Population INTEGER, LifeExpectancy float(3,1), GNP float(10,2), GNPOld float(10,2), LocalName char(45), GovernmentForm char(45), HeadOfState char(60), Capital INTEGER, Code2 char(2)); CREATE TABLE countrylanguage (CountryCode char(3), Language char(30), IsOfficial TEXT, Percentage float(4,1));
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); QUESTION: Which continent has the most diverse languages?
world_1
SELECT DISTINCT T1.Region FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = "English" OR T2.Language = "Dutch"
What are the regions that use English or Dutch?
CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") );
CREATE TABLE city (ID INTEGER, Name char(35), CountryCode char(3), District char(20), Population INTEGER); CREATE TABLE sqlite_sequence (name , seq ); CREATE TABLE country (Code char(3), Name char(52), Continent TEXT, Region char(26), SurfaceArea float(10,2), IndepYear INTEGER, Population INTEGER, LifeExpectancy float(3,1), GNP float(10,2), GNPOld float(10,2), LocalName char(45), GovernmentForm char(45), HeadOfState char(60), Capital INTEGER, Code2 char(2)); CREATE TABLE countrylanguage (CountryCode char(3), Language char(30), IsOfficial TEXT, Percentage float(4,1));
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); QUESTION: What are the regions that use English or Dutch?
world_1
SELECT T2.Language FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T1.GovernmentForm = "Republic" GROUP BY T2.Language HAVING COUNT(*) = 1
Which languages are spoken by only one country in republic governments?
CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") );
CREATE TABLE city (ID INTEGER, Name char(35), CountryCode char(3), District char(20), Population INTEGER); CREATE TABLE sqlite_sequence (name , seq ); CREATE TABLE country (Code char(3), Name char(52), Continent TEXT, Region char(26), SurfaceArea float(10,2), IndepYear INTEGER, Population INTEGER, LifeExpectancy float(3,1), GNP float(10,2), GNPOld float(10,2), LocalName char(45), GovernmentForm char(45), HeadOfState char(60), Capital INTEGER, Code2 char(2)); CREATE TABLE countrylanguage (CountryCode char(3), Language char(30), IsOfficial TEXT, Percentage float(4,1));
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "country" ( "Code" char(3), "Name" char(52), "Continent" TEXT, "Region" char(26), "SurfaceArea" float(10,2), "IndepYear" INTEGER, "Population" INTEGER, "LifeExpectancy" float(3,1), "GNP" float(10,2), "GNPOld" float(10,2), "LocalName" char(45), "GovernmentForm" char(45), "HeadOfState" char(60), "Capital" INTEGER, "Code2" char(2), PRIMARY KEY ("Code") ); CREATE TABLE "city" ( "ID" INTEGER, "Name" char(35), "CountryCode" char(3), "District" char(20), "Population" INTEGER PRIMARY KEY ("ID"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); ALTER TABLE "country" ADD FOREIGN KEY ("Capital") REFERENCES "city"("ID"); CREATE TABLE "countrylanguage" ( "CountryCode" char(3), "Language" char(30), "IsOfficial" TEXT, "Percentage" float(4,1) PRIMARY KEY ("CountryCode","Language"), FOREIGN KEY ("CountryCode") REFERENCES "country"("Code") ); QUESTION: Which languages are spoken by only one country in republic governments?
orchestra
SELECT count(*) FROM conductor
How many conductors are there?
CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) );
CREATE TABLE conductor (Conductor_ID INT, Name TEXT, Age INT, Nationality TEXT, Year_of_Work INT); CREATE TABLE orchestra (Orchestra_ID INT, Orchestra TEXT, Conductor_ID INT, Record_Company TEXT, Year_of_Founded REAL, Major_Record_Format TEXT); CREATE TABLE performance (Performance_ID INT, Orchestra_ID INT, Type TEXT, Date TEXT, Official_ratings_(millions) REAL, Weekly_rank TEXT, Share TEXT); CREATE TABLE show (Show_ID INT, Performance_ID INT, If_first_show bool, Result TEXT, Attendance REAL);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) ); QUESTION: How many conductors are there?
orchestra
SELECT Name FROM conductor ORDER BY Age ASC
List the names of conductors in ascending order of age.
CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) );
CREATE TABLE conductor (Conductor_ID INT, Name TEXT, Age INT, Nationality TEXT, Year_of_Work INT); CREATE TABLE orchestra (Orchestra_ID INT, Orchestra TEXT, Conductor_ID INT, Record_Company TEXT, Year_of_Founded REAL, Major_Record_Format TEXT); CREATE TABLE performance (Performance_ID INT, Orchestra_ID INT, Type TEXT, Date TEXT, Official_ratings_(millions) REAL, Weekly_rank TEXT, Share TEXT); CREATE TABLE show (Show_ID INT, Performance_ID INT, If_first_show bool, Result TEXT, Attendance REAL);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) ); QUESTION: List the names of conductors in ascending order of age.
orchestra
SELECT Name FROM conductor WHERE Nationality != 'USA'
What are the names of conductors whose nationalities are not "USA"?
CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) );
CREATE TABLE conductor (Conductor_ID INT, Name TEXT, Age INT, Nationality TEXT, Year_of_Work INT); CREATE TABLE orchestra (Orchestra_ID INT, Orchestra TEXT, Conductor_ID INT, Record_Company TEXT, Year_of_Founded REAL, Major_Record_Format TEXT); CREATE TABLE performance (Performance_ID INT, Orchestra_ID INT, Type TEXT, Date TEXT, Official_ratings_(millions) REAL, Weekly_rank TEXT, Share TEXT); CREATE TABLE show (Show_ID INT, Performance_ID INT, If_first_show bool, Result TEXT, Attendance REAL);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) ); QUESTION: What are the names of conductors whose nationalities are not "USA"?
orchestra
SELECT max(SHARE) , min(SHARE) FROM performance WHERE TYPE != "Live final"
What are the maximum and minimum share of performances whose type is not "Live final".
CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) );
CREATE TABLE conductor (Conductor_ID INT, Name TEXT, Age INT, Nationality TEXT, Year_of_Work INT); CREATE TABLE orchestra (Orchestra_ID INT, Orchestra TEXT, Conductor_ID INT, Record_Company TEXT, Year_of_Founded REAL, Major_Record_Format TEXT); CREATE TABLE performance (Performance_ID INT, Orchestra_ID INT, Type TEXT, Date TEXT, Official_ratings_(millions) REAL, Weekly_rank TEXT, Share TEXT); CREATE TABLE show (Show_ID INT, Performance_ID INT, If_first_show bool, Result TEXT, Attendance REAL);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) ); QUESTION: What are the maximum and minimum share of performances whose type is not "Live final".
orchestra
SELECT Name FROM conductor ORDER BY Year_of_Work DESC LIMIT 1
List the name of the conductor with the most years of work.
CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) );
CREATE TABLE conductor (Conductor_ID INT, Name TEXT, Age INT, Nationality TEXT, Year_of_Work INT); CREATE TABLE orchestra (Orchestra_ID INT, Orchestra TEXT, Conductor_ID INT, Record_Company TEXT, Year_of_Founded REAL, Major_Record_Format TEXT); CREATE TABLE performance (Performance_ID INT, Orchestra_ID INT, Type TEXT, Date TEXT, Official_ratings_(millions) REAL, Weekly_rank TEXT, Share TEXT); CREATE TABLE show (Show_ID INT, Performance_ID INT, If_first_show bool, Result TEXT, Attendance REAL);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) ); QUESTION: List the name of the conductor with the most years of work.
orchestra
SELECT T1.Name , T2.Orchestra FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID
Show the names of conductors and the orchestras they have conducted.
CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) );
CREATE TABLE conductor (Conductor_ID INT, Name TEXT, Age INT, Nationality TEXT, Year_of_Work INT); CREATE TABLE orchestra (Orchestra_ID INT, Orchestra TEXT, Conductor_ID INT, Record_Company TEXT, Year_of_Founded REAL, Major_Record_Format TEXT); CREATE TABLE performance (Performance_ID INT, Orchestra_ID INT, Type TEXT, Date TEXT, Official_ratings_(millions) REAL, Weekly_rank TEXT, Share TEXT); CREATE TABLE show (Show_ID INT, Performance_ID INT, If_first_show bool, Result TEXT, Attendance REAL);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) ); QUESTION: Show the names of conductors and the orchestras they have conducted.
orchestra
SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID GROUP BY T2.Conductor_ID ORDER BY COUNT(*) DESC LIMIT 1
Show the name of the conductor that has conducted the most number of orchestras.
CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) );
CREATE TABLE conductor (Conductor_ID INT, Name TEXT, Age INT, Nationality TEXT, Year_of_Work INT); CREATE TABLE orchestra (Orchestra_ID INT, Orchestra TEXT, Conductor_ID INT, Record_Company TEXT, Year_of_Founded REAL, Major_Record_Format TEXT); CREATE TABLE performance (Performance_ID INT, Orchestra_ID INT, Type TEXT, Date TEXT, Official_ratings_(millions) REAL, Weekly_rank TEXT, Share TEXT); CREATE TABLE show (Show_ID INT, Performance_ID INT, If_first_show bool, Result TEXT, Attendance REAL);
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) ); QUESTION: Show the name of the conductor that has conducted the most number of orchestras.
orchestra
SELECT Record_Company FROM orchestra GROUP BY Record_Company ORDER BY COUNT(*) DESC LIMIT 1
List the record company shared by the most number of orchestras.
CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) );
CREATE TABLE conductor (Conductor_ID INT, Name TEXT, Age INT, Nationality TEXT, Year_of_Work INT); CREATE TABLE orchestra (Orchestra_ID INT, Orchestra TEXT, Conductor_ID INT, Record_Company TEXT, Year_of_Founded REAL, Major_Record_Format TEXT); CREATE TABLE performance (Performance_ID INT, Orchestra_ID INT, Type TEXT, Date TEXT, Official_ratings_(millions) REAL, Weekly_rank TEXT, Share TEXT); CREATE TABLE show (Show_ID INT, Performance_ID INT, If_first_show bool, Result TEXT, Attendance REAL);
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) ); QUESTION: List the record company shared by the most number of orchestras.
orchestra
SELECT Orchestra FROM orchestra WHERE Orchestra_ID NOT IN (SELECT Orchestra_ID FROM performance)
List the names of orchestras that have no performance.
CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) );
CREATE TABLE conductor (Conductor_ID INT, Name TEXT, Age INT, Nationality TEXT, Year_of_Work INT); CREATE TABLE orchestra (Orchestra_ID INT, Orchestra TEXT, Conductor_ID INT, Record_Company TEXT, Year_of_Founded REAL, Major_Record_Format TEXT); CREATE TABLE performance (Performance_ID INT, Orchestra_ID INT, Type TEXT, Date TEXT, Official_ratings_(millions) REAL, Weekly_rank TEXT, Share TEXT); CREATE TABLE show (Show_ID INT, Performance_ID INT, If_first_show bool, Result TEXT, Attendance REAL);
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) ); QUESTION: List the names of orchestras that have no performance.
orchestra
SELECT Record_Company FROM orchestra WHERE Year_of_Founded < 2003 INTERSECT SELECT Record_Company FROM orchestra WHERE Year_of_Founded > 2003
Show the record companies shared by orchestras founded before 2003 and after 2003.
CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) );
CREATE TABLE conductor (Conductor_ID INT, Name TEXT, Age INT, Nationality TEXT, Year_of_Work INT); CREATE TABLE orchestra (Orchestra_ID INT, Orchestra TEXT, Conductor_ID INT, Record_Company TEXT, Year_of_Founded REAL, Major_Record_Format TEXT); CREATE TABLE performance (Performance_ID INT, Orchestra_ID INT, Type TEXT, Date TEXT, Official_ratings_(millions) REAL, Weekly_rank TEXT, Share TEXT); CREATE TABLE show (Show_ID INT, Performance_ID INT, If_first_show bool, Result TEXT, Attendance REAL);
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "conductor" ( "Conductor_ID" int, "Name" text, "Age" int, "Nationality" text, "Year_of_Work" int, PRIMARY KEY ("Conductor_ID") ); CREATE TABLE "orchestra" ( "Orchestra_ID" int, "Orchestra" text, "Conductor_ID" int, "Record_Company" text, "Year_of_Founded" real, "Major_Record_Format" text, PRIMARY KEY ("Orchestra_ID"), FOREIGN KEY (`Conductor_ID`) REFERENCES `conductor`(`Conductor_ID`) ); CREATE TABLE "performance" ( "Performance_ID" int, "Orchestra_ID" int, "Type" text, "Date" text, "Official_ratings_(millions)" real, "Weekly_rank" text, "Share" text, PRIMARY KEY ("Performance_ID"), FOREIGN KEY (`Orchestra_ID`) REFERENCES `orchestra`(`Orchestra_ID`) ); CREATE TABLE "show" ( "Show_ID" int, "Performance_ID" int, "If_first_show" bool, "Result" text, "Attendance" real, FOREIGN KEY (`Performance_ID`) REFERENCES `performance`(`Performance_ID`) ); QUESTION: Show the record companies shared by orchestras founded before 2003 and after 2003.
network_1
SELECT count(*) FROM Highschooler
How many high schoolers are there?
create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) );
CREATE TABLE Highschooler (ID INT, name TEXT, grade INT); CREATE TABLE Friend (student_id INT, friend_id INT); CREATE TABLE Likes (student_id INT, liked_id INT);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) ); QUESTION: How many high schoolers are there?
network_1
SELECT name , grade FROM Highschooler
Show the names and grades of each high schooler.
create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) );
CREATE TABLE Highschooler (ID INT, name TEXT, grade INT); CREATE TABLE Friend (student_id INT, friend_id INT); CREATE TABLE Likes (student_id INT, liked_id INT);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) ); QUESTION: Show the names and grades of each high schooler.
network_1
SELECT grade FROM Highschooler
Show all the grades of the high schoolers.
create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) );
CREATE TABLE Highschooler (ID INT, name TEXT, grade INT); CREATE TABLE Friend (student_id INT, friend_id INT); CREATE TABLE Likes (student_id INT, liked_id INT);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) ); QUESTION: Show all the grades of the high schoolers.
network_1
SELECT grade FROM Highschooler WHERE name = "Kyle"
What grade is Kyle in?
create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) );
CREATE TABLE Highschooler (ID INT, name TEXT, grade INT); CREATE TABLE Friend (student_id INT, friend_id INT); CREATE TABLE Likes (student_id INT, liked_id INT);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) ); QUESTION: What grade is Kyle in?
network_1
SELECT count(*) FROM Highschooler WHERE grade = 9 OR grade = 10
How many high schoolers are there in grade 9 or 10?
create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) );
CREATE TABLE Highschooler (ID INT, name TEXT, grade INT); CREATE TABLE Friend (student_id INT, friend_id INT); CREATE TABLE Likes (student_id INT, liked_id INT);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) ); QUESTION: How many high schoolers are there in grade 9 or 10?
network_1
SELECT grade , count(*) FROM Highschooler GROUP BY grade
Show the number of high schoolers for each grade.
create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) );
CREATE TABLE Highschooler (ID INT, name TEXT, grade INT); CREATE TABLE Friend (student_id INT, friend_id INT); CREATE TABLE Likes (student_id INT, liked_id INT);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) ); QUESTION: Show the number of high schoolers for each grade.
network_1
SELECT grade FROM Highschooler GROUP BY grade ORDER BY count(*) DESC LIMIT 1
Which grade has the most high schoolers?
create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) );
CREATE TABLE Highschooler (ID INT, name TEXT, grade INT); CREATE TABLE Friend (student_id INT, friend_id INT); CREATE TABLE Likes (student_id INT, liked_id INT);
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) ); QUESTION: Which grade has the most high schoolers?
network_1
SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1
What is the name of the high schooler who has the greatest number of friends?
create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) );
CREATE TABLE Highschooler (ID INT, name TEXT, grade INT); CREATE TABLE Friend (student_id INT, friend_id INT); CREATE TABLE Likes (student_id INT, liked_id INT);
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) ); QUESTION: What is the name of the high schooler who has the greatest number of friends?
network_1
SELECT T3.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id JOIN Highschooler AS T3 ON T1.friend_id = T3.id WHERE T2.name = "Kyle"
Show the names of all of the high schooler Kyle's friends.
create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) );
CREATE TABLE Highschooler (ID INT, name TEXT, grade INT); CREATE TABLE Friend (student_id INT, friend_id INT); CREATE TABLE Likes (student_id INT, liked_id INT);
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) ); QUESTION: Show the names of all of the high schooler Kyle's friends.
network_1
SELECT id FROM Highschooler EXCEPT SELECT student_id FROM Friend
Show ids of all students who do not have any friends.
create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) );
CREATE TABLE Highschooler (ID INT, name TEXT, grade INT); CREATE TABLE Friend (student_id INT, friend_id INT); CREATE TABLE Likes (student_id INT, liked_id INT);
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) ); QUESTION: Show ids of all students who do not have any friends.
network_1
SELECT T2.name FROM Likes AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1
What is the name of the high schooler who has the greatest number of likes?
create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) );
CREATE TABLE Highschooler (ID INT, name TEXT, grade INT); CREATE TABLE Friend (student_id INT, friend_id INT); CREATE TABLE Likes (student_id INT, liked_id INT);
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) ); QUESTION: What is the name of the high schooler who has the greatest number of likes?
network_1
SELECT min(grade) FROM Highschooler WHERE id NOT IN (SELECT T1.student_id FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id)
Find the minimum grade of students who have no friends.
create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) );
CREATE TABLE Highschooler (ID INT, name TEXT, grade INT); CREATE TABLE Friend (student_id INT, friend_id INT); CREATE TABLE Likes (student_id INT, liked_id INT);
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: create table Friend( student_id int, friend_id int, primary key (student_id,friend_id), foreign key(student_id) references Highschooler(ID), foreign key (friend_id) references Highschooler(ID) ); create table Likes( student_id int, liked_id int, primary key (student_id, liked_id), foreign key (liked_id) references Highschooler(ID), foreign key (student_id) references Highschooler(ID) ); QUESTION: Find the minimum grade of students who have no friends.
dog_kennels
SELECT state FROM Owners INTERSECT SELECT state FROM Professionals
Which states have both owners and professionals living there?
CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) );
CREATE TABLE Breeds (breed_code VARCHAR(10), breed_name VARCHAR(80)); CREATE TABLE Charges (charge_id INTEGER, charge_type VARCHAR(10), charge_amount DECIMAL(19,4)); CREATE TABLE Sizes (size_code VARCHAR(10), size_description VARCHAR(80)); CREATE TABLE Treatment_Types (treatment_type_code VARCHAR(10), treatment_type_description VARCHAR(80)); CREATE TABLE Owners (owner_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Dogs (dog_id INTEGER, owner_id INTEGER, abandoned_yn VARCHAR(1), breed_code VARCHAR(10), size_code VARCHAR(10), name VARCHAR(50), age VARCHAR(20), date_of_birth DATETIME, gender VARCHAR(1), weight VARCHAR(20), date_arrived DATETIME, date_adopted DATETIME, date_departed DATETIME); CREATE TABLE Professionals (professional_id INTEGER, role_code VARCHAR(10), first_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), last_name VARCHAR(50), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Treatments (treatment_id INTEGER, dog_id INTEGER, professional_id INTEGER, treatment_type_code VARCHAR(10), date_of_treatment DATETIME, cost_of_treatment DECIMAL(19,4));
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) ); QUESTION: Which states have both owners and professionals living there?
dog_kennels
SELECT avg(age) FROM Dogs WHERE dog_id IN ( SELECT dog_id FROM Treatments )
What is the average age of the dogs who have gone through any treatments?
CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) );
CREATE TABLE Breeds (breed_code VARCHAR(10), breed_name VARCHAR(80)); CREATE TABLE Charges (charge_id INTEGER, charge_type VARCHAR(10), charge_amount DECIMAL(19,4)); CREATE TABLE Sizes (size_code VARCHAR(10), size_description VARCHAR(80)); CREATE TABLE Treatment_Types (treatment_type_code VARCHAR(10), treatment_type_description VARCHAR(80)); CREATE TABLE Owners (owner_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Dogs (dog_id INTEGER, owner_id INTEGER, abandoned_yn VARCHAR(1), breed_code VARCHAR(10), size_code VARCHAR(10), name VARCHAR(50), age VARCHAR(20), date_of_birth DATETIME, gender VARCHAR(1), weight VARCHAR(20), date_arrived DATETIME, date_adopted DATETIME, date_departed DATETIME); CREATE TABLE Professionals (professional_id INTEGER, role_code VARCHAR(10), first_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), last_name VARCHAR(50), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Treatments (treatment_id INTEGER, dog_id INTEGER, professional_id INTEGER, treatment_type_code VARCHAR(10), date_of_treatment DATETIME, cost_of_treatment DECIMAL(19,4));
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) ); QUESTION: What is the average age of the dogs who have gone through any treatments?
dog_kennels
SELECT professional_id , last_name , cell_number FROM Professionals WHERE state = 'Indiana' UNION SELECT T1.professional_id , T1.last_name , T1.cell_number FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id GROUP BY T1.professional_id HAVING count(*) > 2
Which professionals live in the state of Indiana or have done treatment on more than 2 treatments? List his or her id, last name and cell phone.
CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) );
CREATE TABLE Breeds (breed_code VARCHAR(10), breed_name VARCHAR(80)); CREATE TABLE Charges (charge_id INTEGER, charge_type VARCHAR(10), charge_amount DECIMAL(19,4)); CREATE TABLE Sizes (size_code VARCHAR(10), size_description VARCHAR(80)); CREATE TABLE Treatment_Types (treatment_type_code VARCHAR(10), treatment_type_description VARCHAR(80)); CREATE TABLE Owners (owner_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Dogs (dog_id INTEGER, owner_id INTEGER, abandoned_yn VARCHAR(1), breed_code VARCHAR(10), size_code VARCHAR(10), name VARCHAR(50), age VARCHAR(20), date_of_birth DATETIME, gender VARCHAR(1), weight VARCHAR(20), date_arrived DATETIME, date_adopted DATETIME, date_departed DATETIME); CREATE TABLE Professionals (professional_id INTEGER, role_code VARCHAR(10), first_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), last_name VARCHAR(50), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Treatments (treatment_id INTEGER, dog_id INTEGER, professional_id INTEGER, treatment_type_code VARCHAR(10), date_of_treatment DATETIME, cost_of_treatment DECIMAL(19,4));
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) ); QUESTION: Which professionals live in the state of Indiana or have done treatment on more than 2 treatments? List his or her id, last name and cell phone.
dog_kennels
select name from dogs where dog_id not in ( select dog_id from treatments group by dog_id having sum(cost_of_treatment) > 1000 )
Which dogs have not cost their owner more than 1000 for treatment ? List the dog names .
CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) );
CREATE TABLE Breeds (breed_code VARCHAR(10), breed_name VARCHAR(80)); CREATE TABLE Charges (charge_id INTEGER, charge_type VARCHAR(10), charge_amount DECIMAL(19,4)); CREATE TABLE Sizes (size_code VARCHAR(10), size_description VARCHAR(80)); CREATE TABLE Treatment_Types (treatment_type_code VARCHAR(10), treatment_type_description VARCHAR(80)); CREATE TABLE Owners (owner_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Dogs (dog_id INTEGER, owner_id INTEGER, abandoned_yn VARCHAR(1), breed_code VARCHAR(10), size_code VARCHAR(10), name VARCHAR(50), age VARCHAR(20), date_of_birth DATETIME, gender VARCHAR(1), weight VARCHAR(20), date_arrived DATETIME, date_adopted DATETIME, date_departed DATETIME); CREATE TABLE Professionals (professional_id INTEGER, role_code VARCHAR(10), first_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), last_name VARCHAR(50), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Treatments (treatment_id INTEGER, dog_id INTEGER, professional_id INTEGER, treatment_type_code VARCHAR(10), date_of_treatment DATETIME, cost_of_treatment DECIMAL(19,4));
hard
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) ); QUESTION: Which dogs have not cost their owner more than 1000 for treatment ? List the dog names .
dog_kennels
SELECT professional_id , role_code , email_address FROM Professionals EXCEPT SELECT T1.professional_id , T1.role_code , T1.email_address FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id
Which professional did not operate any treatment on dogs? List the professional's id, role and email.
CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) );
CREATE TABLE Breeds (breed_code VARCHAR(10), breed_name VARCHAR(80)); CREATE TABLE Charges (charge_id INTEGER, charge_type VARCHAR(10), charge_amount DECIMAL(19,4)); CREATE TABLE Sizes (size_code VARCHAR(10), size_description VARCHAR(80)); CREATE TABLE Treatment_Types (treatment_type_code VARCHAR(10), treatment_type_description VARCHAR(80)); CREATE TABLE Owners (owner_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Dogs (dog_id INTEGER, owner_id INTEGER, abandoned_yn VARCHAR(1), breed_code VARCHAR(10), size_code VARCHAR(10), name VARCHAR(50), age VARCHAR(20), date_of_birth DATETIME, gender VARCHAR(1), weight VARCHAR(20), date_arrived DATETIME, date_adopted DATETIME, date_departed DATETIME); CREATE TABLE Professionals (professional_id INTEGER, role_code VARCHAR(10), first_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), last_name VARCHAR(50), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Treatments (treatment_id INTEGER, dog_id INTEGER, professional_id INTEGER, treatment_type_code VARCHAR(10), date_of_treatment DATETIME, cost_of_treatment DECIMAL(19,4));
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) ); QUESTION: Which professional did not operate any treatment on dogs? List the professional's id, role and email.
dog_kennels
SELECT T1.owner_id , T2.first_name , T2.last_name FROM Dogs AS T1 JOIN Owners AS T2 ON T1.owner_id = T2.owner_id GROUP BY T1.owner_id ORDER BY count(*) DESC LIMIT 1
Which owner owns the most dogs? List the owner id, first name and last name.
CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) );
CREATE TABLE Breeds (breed_code VARCHAR(10), breed_name VARCHAR(80)); CREATE TABLE Charges (charge_id INTEGER, charge_type VARCHAR(10), charge_amount DECIMAL(19,4)); CREATE TABLE Sizes (size_code VARCHAR(10), size_description VARCHAR(80)); CREATE TABLE Treatment_Types (treatment_type_code VARCHAR(10), treatment_type_description VARCHAR(80)); CREATE TABLE Owners (owner_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Dogs (dog_id INTEGER, owner_id INTEGER, abandoned_yn VARCHAR(1), breed_code VARCHAR(10), size_code VARCHAR(10), name VARCHAR(50), age VARCHAR(20), date_of_birth DATETIME, gender VARCHAR(1), weight VARCHAR(20), date_arrived DATETIME, date_adopted DATETIME, date_departed DATETIME); CREATE TABLE Professionals (professional_id INTEGER, role_code VARCHAR(10), first_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), last_name VARCHAR(50), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Treatments (treatment_id INTEGER, dog_id INTEGER, professional_id INTEGER, treatment_type_code VARCHAR(10), date_of_treatment DATETIME, cost_of_treatment DECIMAL(19,4));
extra
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) ); QUESTION: Which owner owns the most dogs? List the owner id, first name and last name.
dog_kennels
SELECT T1.professional_id , T1.role_code , T1.first_name FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id GROUP BY T1.professional_id HAVING count(*) >= 2
Which professionals have done at least two treatments? List the professional's id, role, and first name.
CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) );
CREATE TABLE Breeds (breed_code VARCHAR(10), breed_name VARCHAR(80)); CREATE TABLE Charges (charge_id INTEGER, charge_type VARCHAR(10), charge_amount DECIMAL(19,4)); CREATE TABLE Sizes (size_code VARCHAR(10), size_description VARCHAR(80)); CREATE TABLE Treatment_Types (treatment_type_code VARCHAR(10), treatment_type_description VARCHAR(80)); CREATE TABLE Owners (owner_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Dogs (dog_id INTEGER, owner_id INTEGER, abandoned_yn VARCHAR(1), breed_code VARCHAR(10), size_code VARCHAR(10), name VARCHAR(50), age VARCHAR(20), date_of_birth DATETIME, gender VARCHAR(1), weight VARCHAR(20), date_arrived DATETIME, date_adopted DATETIME, date_departed DATETIME); CREATE TABLE Professionals (professional_id INTEGER, role_code VARCHAR(10), first_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), last_name VARCHAR(50), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Treatments (treatment_id INTEGER, dog_id INTEGER, professional_id INTEGER, treatment_type_code VARCHAR(10), date_of_treatment DATETIME, cost_of_treatment DECIMAL(19,4));
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) ); QUESTION: Which professionals have done at least two treatments? List the professional's id, role, and first name.
dog_kennels
SELECT T1.professional_id , T1.cell_number FROM Professionals AS T1 JOIN Treatments AS T2 ON T1.professional_id = T2.professional_id GROUP BY T1.professional_id HAVING count(*) >= 2
Which professionals have done at least two types of treatments? List the professional id and cell phone.
CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) );
CREATE TABLE Breeds (breed_code VARCHAR(10), breed_name VARCHAR(80)); CREATE TABLE Charges (charge_id INTEGER, charge_type VARCHAR(10), charge_amount DECIMAL(19,4)); CREATE TABLE Sizes (size_code VARCHAR(10), size_description VARCHAR(80)); CREATE TABLE Treatment_Types (treatment_type_code VARCHAR(10), treatment_type_description VARCHAR(80)); CREATE TABLE Owners (owner_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Dogs (dog_id INTEGER, owner_id INTEGER, abandoned_yn VARCHAR(1), breed_code VARCHAR(10), size_code VARCHAR(10), name VARCHAR(50), age VARCHAR(20), date_of_birth DATETIME, gender VARCHAR(1), weight VARCHAR(20), date_arrived DATETIME, date_adopted DATETIME, date_departed DATETIME); CREATE TABLE Professionals (professional_id INTEGER, role_code VARCHAR(10), first_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), last_name VARCHAR(50), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Treatments (treatment_id INTEGER, dog_id INTEGER, professional_id INTEGER, treatment_type_code VARCHAR(10), date_of_treatment DATETIME, cost_of_treatment DECIMAL(19,4));
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) ); QUESTION: Which professionals have done at least two types of treatments? List the professional id and cell phone.
dog_kennels
SELECT T1.date_of_treatment , T2.first_name FROM Treatments AS T1 JOIN Professionals AS T2 ON T1.professional_id = T2.professional_id
List the date of each treatment, together with the first name of the professional who operated it.
CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) );
CREATE TABLE Breeds (breed_code VARCHAR(10), breed_name VARCHAR(80)); CREATE TABLE Charges (charge_id INTEGER, charge_type VARCHAR(10), charge_amount DECIMAL(19,4)); CREATE TABLE Sizes (size_code VARCHAR(10), size_description VARCHAR(80)); CREATE TABLE Treatment_Types (treatment_type_code VARCHAR(10), treatment_type_description VARCHAR(80)); CREATE TABLE Owners (owner_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Dogs (dog_id INTEGER, owner_id INTEGER, abandoned_yn VARCHAR(1), breed_code VARCHAR(10), size_code VARCHAR(10), name VARCHAR(50), age VARCHAR(20), date_of_birth DATETIME, gender VARCHAR(1), weight VARCHAR(20), date_arrived DATETIME, date_adopted DATETIME, date_departed DATETIME); CREATE TABLE Professionals (professional_id INTEGER, role_code VARCHAR(10), first_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), last_name VARCHAR(50), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Treatments (treatment_id INTEGER, dog_id INTEGER, professional_id INTEGER, treatment_type_code VARCHAR(10), date_of_treatment DATETIME, cost_of_treatment DECIMAL(19,4));
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) ); QUESTION: List the date of each treatment, together with the first name of the professional who operated it.
dog_kennels
SELECT count(DISTINCT dog_id) FROM Treatments
How many dogs went through any treatments?
CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) );
CREATE TABLE Breeds (breed_code VARCHAR(10), breed_name VARCHAR(80)); CREATE TABLE Charges (charge_id INTEGER, charge_type VARCHAR(10), charge_amount DECIMAL(19,4)); CREATE TABLE Sizes (size_code VARCHAR(10), size_description VARCHAR(80)); CREATE TABLE Treatment_Types (treatment_type_code VARCHAR(10), treatment_type_description VARCHAR(80)); CREATE TABLE Owners (owner_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Dogs (dog_id INTEGER, owner_id INTEGER, abandoned_yn VARCHAR(1), breed_code VARCHAR(10), size_code VARCHAR(10), name VARCHAR(50), age VARCHAR(20), date_of_birth DATETIME, gender VARCHAR(1), weight VARCHAR(20), date_arrived DATETIME, date_adopted DATETIME, date_departed DATETIME); CREATE TABLE Professionals (professional_id INTEGER, role_code VARCHAR(10), first_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), last_name VARCHAR(50), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Treatments (treatment_id INTEGER, dog_id INTEGER, professional_id INTEGER, treatment_type_code VARCHAR(10), date_of_treatment DATETIME, cost_of_treatment DECIMAL(19,4));
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) ); QUESTION: How many dogs went through any treatments?
dog_kennels
SELECT count(DISTINCT professional_id) FROM Treatments
How many professionals have performed any treatment to dogs?
CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) );
CREATE TABLE Breeds (breed_code VARCHAR(10), breed_name VARCHAR(80)); CREATE TABLE Charges (charge_id INTEGER, charge_type VARCHAR(10), charge_amount DECIMAL(19,4)); CREATE TABLE Sizes (size_code VARCHAR(10), size_description VARCHAR(80)); CREATE TABLE Treatment_Types (treatment_type_code VARCHAR(10), treatment_type_description VARCHAR(80)); CREATE TABLE Owners (owner_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Dogs (dog_id INTEGER, owner_id INTEGER, abandoned_yn VARCHAR(1), breed_code VARCHAR(10), size_code VARCHAR(10), name VARCHAR(50), age VARCHAR(20), date_of_birth DATETIME, gender VARCHAR(1), weight VARCHAR(20), date_arrived DATETIME, date_adopted DATETIME, date_departed DATETIME); CREATE TABLE Professionals (professional_id INTEGER, role_code VARCHAR(10), first_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), last_name VARCHAR(50), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Treatments (treatment_id INTEGER, dog_id INTEGER, professional_id INTEGER, treatment_type_code VARCHAR(10), date_of_treatment DATETIME, cost_of_treatment DECIMAL(19,4));
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) ); QUESTION: How many professionals have performed any treatment to dogs?
dog_kennels
SELECT avg(age) FROM Dogs
What is the average age of all the dogs?
CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) );
CREATE TABLE Breeds (breed_code VARCHAR(10), breed_name VARCHAR(80)); CREATE TABLE Charges (charge_id INTEGER, charge_type VARCHAR(10), charge_amount DECIMAL(19,4)); CREATE TABLE Sizes (size_code VARCHAR(10), size_description VARCHAR(80)); CREATE TABLE Treatment_Types (treatment_type_code VARCHAR(10), treatment_type_description VARCHAR(80)); CREATE TABLE Owners (owner_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Dogs (dog_id INTEGER, owner_id INTEGER, abandoned_yn VARCHAR(1), breed_code VARCHAR(10), size_code VARCHAR(10), name VARCHAR(50), age VARCHAR(20), date_of_birth DATETIME, gender VARCHAR(1), weight VARCHAR(20), date_arrived DATETIME, date_adopted DATETIME, date_departed DATETIME); CREATE TABLE Professionals (professional_id INTEGER, role_code VARCHAR(10), first_name VARCHAR(50), street VARCHAR(50), city VARCHAR(50), state VARCHAR(20), zip_code VARCHAR(20), last_name VARCHAR(50), email_address VARCHAR(50), home_phone VARCHAR(20), cell_number VARCHAR(20)); CREATE TABLE Treatments (treatment_id INTEGER, dog_id INTEGER, professional_id INTEGER, treatment_type_code VARCHAR(10), date_of_treatment DATETIME, cost_of_treatment DECIMAL(19,4));
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE `Breeds` ( `breed_code` VARCHAR(10) PRIMARY KEY , `breed_name` VARCHAR(80) ); CREATE TABLE `Charges` ( `charge_id` INTEGER PRIMARY KEY , `charge_type` VARCHAR(10), `charge_amount` DECIMAL(19,4) ); CREATE TABLE `Sizes` ( `size_code` VARCHAR(10) PRIMARY KEY , `size_description` VARCHAR(80) ); CREATE TABLE `Treatment_Types` ( `treatment_type_code` VARCHAR(10) PRIMARY KEY , `treatment_type_description` VARCHAR(80) ); CREATE TABLE `Owners` ( `owner_id` INTEGER PRIMARY KEY , `first_name` VARCHAR(50), `last_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Dogs` ( `dog_id` INTEGER PRIMARY KEY , `owner_id` INTEGER NOT NULL, `abandoned_yn` VARCHAR(1), `breed_code` VARCHAR(10) NOT NULL, `size_code` VARCHAR(10) NOT NULL, `name` VARCHAR(50), `age` VARCHAR(20), `date_of_birth` DATETIME, `gender` VARCHAR(1), `weight` VARCHAR(20), `date_arrived` DATETIME, `date_adopted` DATETIME, `date_departed` DATETIME, FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ), FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ), FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ) ); CREATE TABLE `Professionals` ( `professional_id` INTEGER PRIMARY KEY , `role_code` VARCHAR(10) NOT NULL, `first_name` VARCHAR(50), `street` VARCHAR(50), `city` VARCHAR(50), `state` VARCHAR(20), `zip_code` VARCHAR(20), `last_name` VARCHAR(50), `email_address` VARCHAR(50), `home_phone` VARCHAR(20), `cell_number` VARCHAR(20) ); CREATE TABLE `Treatments` ( `treatment_id` INTEGER PRIMARY KEY , `dog_id` INTEGER NOT NULL, `professional_id` INTEGER NOT NULL, `treatment_type_code` VARCHAR(10) NOT NULL, `date_of_treatment` DATETIME, `cost_of_treatment` DECIMAL(19,4), FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ), FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ), FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` ) ); QUESTION: What is the average age of all the dogs?
singer
SELECT count(*) FROM singer
How many singers are there?
CREATE TABLE "singer" ( "Singer_ID" int, "Name" text, "Birth_Year" real, "Net_Worth_Millions" real, "Citizenship" text, PRIMARY KEY ("Singer_ID") ); CREATE TABLE "song" ( "Song_ID" int, "Title" text, "Singer_ID" int, "Sales" real, "Highest_Position" real, PRIMARY KEY ("Song_ID"), FOREIGN KEY ("Singer_ID") REFERENCES `singer`("Singer_ID") );
CREATE TABLE singer (Singer_ID INT, Name TEXT, Birth_Year REAL, Net_Worth_Millions REAL, Citizenship TEXT); CREATE TABLE song (Song_ID INT, Title TEXT, Singer_ID INT, Sales REAL, Highest_Position REAL);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "singer" ( "Singer_ID" int, "Name" text, "Birth_Year" real, "Net_Worth_Millions" real, "Citizenship" text, PRIMARY KEY ("Singer_ID") ); CREATE TABLE "song" ( "Song_ID" int, "Title" text, "Singer_ID" int, "Sales" real, "Highest_Position" real, PRIMARY KEY ("Song_ID"), FOREIGN KEY ("Singer_ID") REFERENCES `singer`("Singer_ID") ); QUESTION: How many singers are there?
singer
SELECT Name FROM singer ORDER BY Net_Worth_Millions ASC
List the name of singers in ascending order of net worth.
CREATE TABLE "singer" ( "Singer_ID" int, "Name" text, "Birth_Year" real, "Net_Worth_Millions" real, "Citizenship" text, PRIMARY KEY ("Singer_ID") ); CREATE TABLE "song" ( "Song_ID" int, "Title" text, "Singer_ID" int, "Sales" real, "Highest_Position" real, PRIMARY KEY ("Song_ID"), FOREIGN KEY ("Singer_ID") REFERENCES `singer`("Singer_ID") );
CREATE TABLE singer (Singer_ID INT, Name TEXT, Birth_Year REAL, Net_Worth_Millions REAL, Citizenship TEXT); CREATE TABLE song (Song_ID INT, Title TEXT, Singer_ID INT, Sales REAL, Highest_Position REAL);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "singer" ( "Singer_ID" int, "Name" text, "Birth_Year" real, "Net_Worth_Millions" real, "Citizenship" text, PRIMARY KEY ("Singer_ID") ); CREATE TABLE "song" ( "Song_ID" int, "Title" text, "Singer_ID" int, "Sales" real, "Highest_Position" real, PRIMARY KEY ("Song_ID"), FOREIGN KEY ("Singer_ID") REFERENCES `singer`("Singer_ID") ); QUESTION: List the name of singers in ascending order of net worth.
singer
SELECT Birth_Year , Citizenship FROM singer
What are the birth year and citizenship of singers?
CREATE TABLE "singer" ( "Singer_ID" int, "Name" text, "Birth_Year" real, "Net_Worth_Millions" real, "Citizenship" text, PRIMARY KEY ("Singer_ID") ); CREATE TABLE "song" ( "Song_ID" int, "Title" text, "Singer_ID" int, "Sales" real, "Highest_Position" real, PRIMARY KEY ("Song_ID"), FOREIGN KEY ("Singer_ID") REFERENCES `singer`("Singer_ID") );
CREATE TABLE singer (Singer_ID INT, Name TEXT, Birth_Year REAL, Net_Worth_Millions REAL, Citizenship TEXT); CREATE TABLE song (Song_ID INT, Title TEXT, Singer_ID INT, Sales REAL, Highest_Position REAL);
medium
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "singer" ( "Singer_ID" int, "Name" text, "Birth_Year" real, "Net_Worth_Millions" real, "Citizenship" text, PRIMARY KEY ("Singer_ID") ); CREATE TABLE "song" ( "Song_ID" int, "Title" text, "Singer_ID" int, "Sales" real, "Highest_Position" real, PRIMARY KEY ("Song_ID"), FOREIGN KEY ("Singer_ID") REFERENCES `singer`("Singer_ID") ); QUESTION: What are the birth year and citizenship of singers?
singer
SELECT Name FROM singer WHERE Citizenship != "France"
List the name of singers whose citizenship is not "France".
CREATE TABLE "singer" ( "Singer_ID" int, "Name" text, "Birth_Year" real, "Net_Worth_Millions" real, "Citizenship" text, PRIMARY KEY ("Singer_ID") ); CREATE TABLE "song" ( "Song_ID" int, "Title" text, "Singer_ID" int, "Sales" real, "Highest_Position" real, PRIMARY KEY ("Song_ID"), FOREIGN KEY ("Singer_ID") REFERENCES `singer`("Singer_ID") );
CREATE TABLE singer (Singer_ID INT, Name TEXT, Birth_Year REAL, Net_Worth_Millions REAL, Citizenship TEXT); CREATE TABLE song (Song_ID INT, Title TEXT, Singer_ID INT, Sales REAL, Highest_Position REAL);
easy
Provide the SQL query that answers the QUESTION, with no explanation or special characters. CONTEXT: Relevant SQL tables, with their properties: CREATE TABLE "singer" ( "Singer_ID" int, "Name" text, "Birth_Year" real, "Net_Worth_Millions" real, "Citizenship" text, PRIMARY KEY ("Singer_ID") ); CREATE TABLE "song" ( "Song_ID" int, "Title" text, "Singer_ID" int, "Sales" real, "Highest_Position" real, PRIMARY KEY ("Song_ID"), FOREIGN KEY ("Singer_ID") REFERENCES `singer`("Singer_ID") ); QUESTION: List the name of singers whose citizenship is not "France".