db_id stringlengths 4 31 | SQL stringlengths 18 1.45k | input_sequence stringlengths 148 11k | question stringlengths 16 325 |
|---|---|---|---|
cre_Doc_Template_Mgt | select document_id from paragraphs group by document_id having count(*) >= 2 | Question: what are the ids of documents that have 2 or more paragraphs? | Tables: Ref_Template_Types -> Template_Type_Code, Template_Type_Description. Templates -> Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details. Documents -> Document_ID, Template_ID, Document_N... | what are the ids of documents that have 2 or more paragraphs? |
cre_Doc_Template_Mgt | select t1.document_id , t2.document_name from paragraphs as t1 join documents as t2 on t1.document_id = t2.document_id group by t1.document_id order by count(*) desc limit 1 | Question: what is the document id and name with greatest number of paragraphs? | Tables: Ref_Template_Types -> Template_Type_Code, Template_Type_Description. Templates -> Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details. Documents -> Document_ID, Template_ID, Doc... | what is the document id and name with greatest number of paragraphs? |
cre_Doc_Template_Mgt | select t1.document_id , t2.document_name from paragraphs as t1 join documents as t2 on t1.document_id = t2.document_id group by t1.document_id order by count(*) desc limit 1 | Question: return the id and name of the document with the most paragraphs. | Tables: Ref_Template_Types -> Template_Type_Code, Template_Type_Description. Templates -> Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details. Documents -> Document_ID, Template_ID, Documen... | return the id and name of the document with the most paragraphs. |
cre_Doc_Template_Mgt | select document_id from paragraphs group by document_id order by count(*) asc limit 1 | Question: what is the document id with least number of paragraphs? | Tables: Ref_Template_Types -> Template_Type_Code, Template_Type_Description. Templates -> Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details. Documents -> Document_ID, Template_ID, Document_Name, ... | what is the document id with least number of paragraphs? |
cre_Doc_Template_Mgt | select document_id from paragraphs group by document_id order by count(*) asc limit 1 | Question: return the id of the document with the fewest paragraphs. | Tables: Ref_Template_Types -> Template_Type_Code, Template_Type_Description. Templates -> Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details. Documents -> Document_ID, Template_ID, Document_Name,... | return the id of the document with the fewest paragraphs. |
cre_Doc_Template_Mgt | select document_id from paragraphs group by document_id having count(*) between 1 and 2 | Question: what is the document id with 1 to 2 paragraphs? | Tables: Ref_Template_Types -> Template_Type_Code, Template_Type_Description. Templates -> Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details. Documents -> Document_ID, Template_ID, Document_Name, Document_... | what is the document id with 1 to 2 paragraphs? |
cre_Doc_Template_Mgt | select document_id from paragraphs group by document_id having count(*) between 1 and 2 | Question: give the ids of documents that have between one and two paragraphs. | Tables: Ref_Template_Types -> Template_Type_Code, Template_Type_Description. Templates -> Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details. Documents -> Document_ID, Template_ID, Docu... | give the ids of documents that have between one and two paragraphs. |
cre_Doc_Template_Mgt | select document_id from paragraphs where paragraph_text = 'brazil' intersect select document_id from paragraphs where paragraph_text = 'ireland' | Question: show the document id with paragraph text 'brazil' and 'ireland'. | Tables: Ref_Template_Types -> Template_Type_Code, Template_Type_Description. Templates -> Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details. Documents -> Document_ID, Template_ID, Documen... | show the document id with paragraph text 'brazil' and 'ireland'. |
cre_Doc_Template_Mgt | select document_id from paragraphs where paragraph_text = 'brazil' intersect select document_id from paragraphs where paragraph_text = 'ireland' | Question: what are the ids of documents that contain the paragraph text 'brazil' and 'ireland'? | Tables: Ref_Template_Types -> Template_Type_Code, Template_Type_Description. Templates -> Template_ID, Version_Number, Template_Type_Code, Date_Effective_From, Date_Effective_To, Template_Details. Documents -> Document_ID,... | what are the ids of documents that contain the paragraph text 'brazil' and 'ireland'? |
course_teach | select count(*) from teacher | Question: how many teachers are there? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | how many teachers are there? |
course_teach | select count(*) from teacher | Question: what is the total count of teachers? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | what is the total count of teachers? |
course_teach | select name from teacher order by age asc | Question: list the names of teachers in ascending order of age. | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | list the names of teachers in ascending order of age. |
course_teach | select name from teacher order by age asc | Question: what are the names of the teachers ordered by ascending age? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | what are the names of the teachers ordered by ascending age? |
course_teach | select age , hometown from teacher | Question: what are the age and hometown of teachers? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | what are the age and hometown of teachers? |
course_teach | select age , hometown from teacher | Question: what is the age and hometown of every teacher? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | what is the age and hometown of every teacher? |
course_teach | select name from teacher where hometown != 'little lever urban district' | Question: list the name of teachers whose hometown is not `` little lever urban district '' . | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID... | list the name of teachers whose hometown is not `` little lever urban district '' . |
course_teach | select name from teacher where hometown != 'little lever urban district' | Question: what are the names of the teachers whose hometown is not `` little lever urban district '' ? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.... | what are the names of the teachers whose hometown is not `` little lever urban district '' ? |
course_teach | select name from teacher where age = 32 or age = 33 | Question: show the name of teachers aged either 32 or 33? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | show the name of teachers aged either 32 or 33? |
course_teach | select name from teacher where age = 32 or age = 33 | Question: what are the names of the teachers who are aged either 32 or 33? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID... | what are the names of the teachers who are aged either 32 or 33? |
course_teach | select hometown from teacher order by age asc limit 1 | Question: what is the hometown of the youngest teacher? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | what is the hometown of the youngest teacher? |
course_teach | select hometown from teacher order by age asc limit 1 | Question: where is the youngest teacher from? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | where is the youngest teacher from? |
course_teach | select hometown , count(*) from teacher group by hometown | Question: show different hometown of teachers and the number of teachers from each hometown. | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID ... | show different hometown of teachers and the number of teachers from each hometown. |
course_teach | select hometown , count(*) from teacher group by hometown | Question: for each hometown, how many teachers are there? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | for each hometown, how many teachers are there? |
course_teach | select hometown from teacher group by hometown order by count(*) desc limit 1 | Question: list the most common hometown of teachers. | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | list the most common hometown of teachers. |
course_teach | select hometown from teacher group by hometown order by count(*) desc limit 1 | Question: what is the most commmon hometowns for teachers? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | what is the most commmon hometowns for teachers? |
course_teach | select hometown from teacher group by hometown having count(*) >= 2 | Question: show the hometowns shared by at least two teachers. | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | show the hometowns shared by at least two teachers. |
course_teach | select hometown from teacher group by hometown having count(*) >= 2 | Question: what are the towns from which at least two teachers come from? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | what are the towns from which at least two teachers come from? |
course_teach | select t3.name , t2.course from course_arrange as t1 join course as t2 on t1.course_id = t2.course_id join teacher as t3 on t1.teacher_id = t3.teacher_id | Question: show names of teachers and the courses they are arranged to teach. | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_... | show names of teachers and the courses they are arranged to teach. |
course_teach | select t3.name , t2.course from course_arrange as t1 join course as t2 on t1.course_id = t2.course_id join teacher as t3 on t1.teacher_id = t3.teacher_id | Question: what is the name of each teacher and what course they teach? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | what is the name of each teacher and what course they teach? |
course_teach | select t3.name , t2.course from course_arrange as t1 join course as t2 on t1.course_id = t2.course_id join teacher as t3 on t1.teacher_id = t3.teacher_id order by t3.name | Question: show names of teachers and the courses they are arranged to teach in ascending alphabetical order of the teacher's name. | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher... | show names of teachers and the courses they are arranged to teach in ascending alphabetical order of the teacher's name. |
course_teach | select t3.name , t2.course from course_arrange as t1 join course as t2 on t1.course_id = t2.course_id join teacher as t3 on t1.teacher_id = t3.teacher_id order by t3.name | Question: what are the names of the teachers and the courses they teach in ascending alphabetical order by the name of the teacher? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teache... | what are the names of the teachers and the courses they teach in ascending alphabetical order by the name of the teacher? |
course_teach | select t3.name from course_arrange as t1 join course as t2 on t1.course_id = t2.course_id join teacher as t3 on t1.teacher_id = t3.teacher_id where t2.course = 'math' | Question: show the name of the teacher for the math course. | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | show the name of the teacher for the math course. |
course_teach | select t3.name from course_arrange as t1 join course as t2 on t1.course_id = t2.course_id join teacher as t3 on t1.teacher_id = t3.teacher_id where t2.course = 'math' | Question: what are the names of the people who teach math courses? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | what are the names of the people who teach math courses? |
course_teach | select t2.name , count(*) from course_arrange as t1 join teacher as t2 on t1.teacher_id = t2.teacher_id group by t2.name | Question: show names of teachers and the number of courses they teach. | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | show names of teachers and the number of courses they teach. |
course_teach | select t2.name , count(*) from course_arrange as t1 join teacher as t2 on t1.teacher_id = t2.teacher_id group by t2.name | Question: what are the names of the teachers and how many courses do they teach? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Cou... | what are the names of the teachers and how many courses do they teach? |
course_teach | select t2.name from course_arrange as t1 join teacher as t2 on t1.teacher_id = t2.teacher_id group by t2.name having count(*) >= 2 | Question: show names of teachers that teach at least two courses. | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_ID, | show names of teachers that teach at least two courses. |
course_teach | select t2.name from course_arrange as t1 join teacher as t2 on t1.teacher_id = t2.teacher_id group by t2.name having count(*) >= 2 | Question: what are the names of the teachers who teach at least two courses? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Course_... | what are the names of the teachers who teach at least two courses? |
course_teach | select name from teacher where teacher_id not in (select teacher_id from course_arrange) | Question: list the names of teachers who have not been arranged to teach courses. | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.Co... | list the names of teachers who have not been arranged to teach courses. |
course_teach | select name from teacher where teacher_id not in (select teacher_id from course_arrange) | Question: what are the names of the teachers whose courses have not been arranged? | Tables: course -> Course_ID, Staring_Date, Course. teacher -> Teacher_ID, Name, Age, Hometown. course_arrange -> Course_ID, Teacher_ID, Grade. | Joins: course_arrange.Teacher_ID = teacher.Teacher_ID, course_arrange.Course_ID = course.C... | what are the names of the teachers whose courses have not been arranged? |
museum_visit | select count(*) from visitor where age < 30 | Question: how many visitors below age 30 are there? | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: visit.visitor_ID = visitor.ID, visit.Museum_ID = museum.Museum_ID, | how many visitors below age 30 are there? |
museum_visit | select name from visitor where level_of_membership > 4 order by level_of_membership desc | Question: find the names of the visitors whose membership level is higher than 4, and order the results by the level from high to low. | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: visit.v... | find the names of the visitors whose membership level is higher than 4, and order the results by the level from high to low. |
museum_visit | select avg(age) from visitor where level_of_membership <= 4 | Question: what is the average age of the visitors whose membership level is not higher than 4? | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: visit.visitor_ID = visitor.ID, visit.Museum_ID ... | what is the average age of the visitors whose membership level is not higher than 4? |
museum_visit | select name , level_of_membership from visitor where level_of_membership > 4 order by age desc | Question: find the name and membership level of the visitors whose membership level is higher than 4, and sort by their age from old to young. | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins:... | find the name and membership level of the visitors whose membership level is higher than 4, and sort by their age from old to young. |
museum_visit | select museum_id , name from museum order by num_of_staff desc limit 1 | Question: find the id and name of the museum that has the most staff members? | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: visit.visitor_ID = visitor.ID, visit.Museum_ID = museum.Museum_I... | find the id and name of the museum that has the most staff members? |
museum_visit | select avg(num_of_staff) from museum where open_year < 2009 | Question: find the average number of staff working for the museums that were open before 2009. | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: visit.visitor_ID = visitor.ID, visit.Museum_ID ... | find the average number of staff working for the museums that were open before 2009. |
museum_visit | select num_of_staff , open_year from museum where name = 'plaza museum' | Question: what are the opening year and staff number of the museum named plaza museum? | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: visit.visitor_ID = visitor.ID, visit.Museum_ID = museum... | what are the opening year and staff number of the museum named plaza museum? |
museum_visit | select name from museum where num_of_staff > (select min(num_of_staff) from museum where open_year > 2010) | Question: find the names of museums which have more staff than the minimum staff number of all museums opened after 2010. | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: visit.visitor_ID = v... | find the names of museums which have more staff than the minimum staff number of all museums opened after 2010. |
museum_visit | select t1.id , t1.name , t1.age from visitor as t1 join visit as t2 on t1.id = t2.visitor_id group by t1.id having count(*) > 1 | Question: find the id, name and age for visitors who visited some museums more than once. | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: visit.visitor_ID = visitor.ID, visit.Museum_ID = mus... | find the id, name and age for visitors who visited some museums more than once. |
museum_visit | select t2.visitor_id , t1.name , t1.level_of_membership from visitor as t1 join visit as t2 on t1.id = t2.visitor_id group by t2.visitor_id order by sum(t2.total_spent) desc limit 1 | Question: what are the id, name and membership level of visitors who have spent the largest amount of money in total in all museum tickets? | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: vi... | what are the id, name and membership level of visitors who have spent the largest amount of money in total in all museum tickets? |
museum_visit | select t2.museum_id , t1.name from museum as t1 join visit as t2 on t1.museum_id = t2.museum_id group by t2.museum_id order by count(*) desc limit 1 | Question: what are the id and name of the museum visited most times? | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: visit.visitor_ID = visitor.ID, visit.Museum_ID = museum.Museum_ID, | what are the id and name of the museum visited most times? |
museum_visit | select name from museum where museum_id not in (select museum_id from visit) | Question: what is the name of the museum that had no visitor yet? | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: visit.visitor_ID = visitor.ID, visit.Museum_ID = museum.Museum_ID, | what is the name of the museum that had no visitor yet? |
museum_visit | select t1.name , t1.age from visitor as t1 join visit as t2 on t1.id = t2.visitor_id order by t2.num_of_ticket desc limit 1 | Question: find the name and age of the visitor who bought the most tickets at once. | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: visit.visitor_ID = visitor.ID, visit.Museum_ID = museum.Mu... | find the name and age of the visitor who bought the most tickets at once. |
museum_visit | select avg(num_of_ticket) , max(num_of_ticket) from visit | Question: what are the average and maximum number of tickets bought in all visits? | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: visit.visitor_ID = visitor.ID, visit.Museum_ID = museum.Mus... | what are the average and maximum number of tickets bought in all visits? |
museum_visit | select sum(t2.total_spent) from visitor as t1 join visit as t2 on t1.id = t2.visitor_id where t1.level_of_membership = 1 | Question: what is the total ticket expense of the visitors whose membership level is 1? | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: visit.visitor_ID = visitor.ID, visit.Museum_ID = museu... | what is the total ticket expense of the visitors whose membership level is 1? |
museum_visit | select t1.name from visitor as t1 join visit as t2 on t1.id = t2.visitor_id join museum as t3 on t3.museum_id = t2.museum_id where t3.open_year < 2009 intersect select t1.name from visitor as t1 join visit as t2 on t1.id = t2.visitor_id join museum as t3 on t3.museum_id = t2.museum_id where t3.open_year > 2... | Question: what is the name of the visitor who visited both a museum opened before 2009 and a museum opened after 2011? | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: visit.visitor_ID = visi... | what is the name of the visitor who visited both a museum opened before 2009 and a museum opened after 2011? |
museum_visit | select count(*) from visitor where id not in (select t2.visitor_id from museum as t1 join visit as t2 on t1.museum_id = t2.museum_id where t1.open_year > 2010) | Question: find the number of visitors who did not visit any museum opened after 2010. | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: visit.visitor_ID = visitor.ID, visit.Museum_ID = museum.... | find the number of visitors who did not visit any museum opened after 2010. |
museum_visit | select count(*) from museum where open_year > 2013 or open_year < 2008 | Question: how many museums were opened after 2013 or before 2008? | Tables: museum -> Museum_ID, Name, Num_of_Staff, Open_Year. visitor -> ID, Name, Level_of_membership, Age. visit -> Museum_ID, visitor_ID, Num_of_Ticket, Total_spent. | Joins: visit.visitor_ID = visitor.ID, visit.Museum_ID = museum.Museum_ID, | how many museums were opened after 2013 or before 2008? |
wta_1 | select count(*) from players | Question: find the total number of players. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, su... | find the total number of players. |
wta_1 | select count(*) from players | Question: how many players are there? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface,... | how many players are there? |
wta_1 | select count(*) from matches | Question: find the total number of matches. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, su... | find the total number of matches. |
wta_1 | select count(*) from matches | Question: count the number of matches. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface... | count the number of matches. |
wta_1 | select first_name , birth_date from players where country_code = 'usa' | Question: list the first name and birth date of all players from the country with code usa. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, ... | list the first name and birth date of all players from the country with code usa. |
wta_1 | select first_name , birth_date from players where country_code = 'usa' | Question: what are the first names and birth dates of players from the usa? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, matc... | what are the first names and birth dates of players from the usa? |
wta_1 | select avg(loser_age) , avg(winner_age) from matches | Question: find the average age of losers and winners of all matches. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, ... | find the average age of losers and winners of all matches. |
wta_1 | select avg(loser_age) , avg(winner_age) from matches | Question: what are the average ages of losers and winners across matches? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_... | what are the average ages of losers and winners across matches? |
wta_1 | select avg(winner_rank) from matches | Question: find the average rank of winners in all matches. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, r... | find the average rank of winners in all matches. |
wta_1 | select avg(winner_rank) from matches | Question: what is the average rank for winners in all matches? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minute... | what is the average rank for winners in all matches? |
wta_1 | select min(loser_rank) from matches | Question: find the highest rank of losers in all matches. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, ro... | find the highest rank of losers in all matches. |
wta_1 | select min(loser_rank) from matches | Question: what is the best rank of losers across all matches? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes... | what is the best rank of losers across all matches? |
wta_1 | select count(distinct country_code) from players | Question: find the number of distinct country codes of all players. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, m... | find the number of distinct country codes of all players. |
wta_1 | select count(distinct country_code) from players | Question: how many distinct countries do players come from? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, ... | how many distinct countries do players come from? |
wta_1 | select count(distinct loser_name) from matches | Question: find the number of distinct name of losers. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round,... | find the number of distinct name of losers. |
wta_1 | select count(distinct loser_name) from matches | Question: how many different loser names are there? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, s... | how many different loser names are there? |
wta_1 | select tourney_name from matches group by tourney_name having count(*) > 10 | Question: find the name of tourney that has more than 10 matches. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, min... | find the name of tourney that has more than 10 matches. |
wta_1 | select tourney_name from matches group by tourney_name having count(*) > 10 | Question: what are the names of tournaments that have more than 10 matches? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, matc... | what are the names of tournaments that have more than 10 matches? |
wta_1 | select winner_name from matches where year = 2013 intersect select winner_name from matches where year = 2016 | Question: list the names of all winners who played in both 2013 and 2016. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_... | list the names of all winners who played in both 2013 and 2016. |
wta_1 | select winner_name from matches where year = 2013 intersect select winner_name from matches where year = 2016 | Question: what are the names of players who won in both 2013 and 2016? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num... | what are the names of players who won in both 2013 and 2016? |
wta_1 | select count(*) from matches where year = 2013 or year = 2016 | Question: list the number of all matches who played in years of 2013 or 2016. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, ma... | list the number of all matches who played in years of 2013 or 2016. |
wta_1 | select count(*) from matches where year = 2013 or year = 2016 | Question: how many matches were played in 2013 or 2016? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, roun... | how many matches were played in 2013 or 2016? |
wta_1 | select t1.country_code , t1.first_name from players as t1 join matches as t2 on t1.player_id = t2.winner_id where t2.tourney_name = 'wta championships' intersect select t1.country_code , t1.first_name from players as t1 join matches as t2 on t1.player_id = t2.winner_id where t2.tourney_name = 'australian open... | Question: what are the country code and first name of the players who won in both tourney wta championships and australian open? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_... | what are the country code and first name of the players who won in both tourney wta championships and australian open? |
wta_1 | select t1.country_code , t1.first_name from players as t1 join matches as t2 on t1.player_id = t2.winner_id where t2.tourney_name = 'wta championships' intersect select t1.country_code , t1.first_name from players as t1 join matches as t2 on t1.player_id = t2.winner_id where t2.tourney_name = 'australian open... | Question: what are the first names and country codes for players who won both the wta championships and the australian open? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name... | what are the first names and country codes for players who won both the wta championships and the australian open? |
wta_1 | select first_name , country_code from players order by birth_date limit 1 | Question: find the first name and country code of the oldest player. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, ... | find the first name and country code of the oldest player. |
wta_1 | select first_name , country_code from players order by birth_date limit 1 | Question: what is the first name and country code of the oldest player? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_nu... | what is the first name and country code of the oldest player? |
wta_1 | select first_name , last_name from players order by birth_date | Question: list the first and last name of all players in the order of birth date. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed... | list the first and last name of all players in the order of birth date. |
wta_1 | select first_name , last_name from players order by birth_date | Question: what are the full names of all players, sorted by birth date? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_nu... | what are the full names of all players, sorted by birth date? |
wta_1 | select first_name , last_name from players where hand = 'l' order by birth_date | Question: list the first and last name of all players who are left / l hand in the order of birth date. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_r... | list the first and last name of all players who are left / l hand in the order of birth date. |
wta_1 | select first_name , last_name from players where hand = 'l' order by birth_date | Question: what are the full names of all left handed players, in order of birth date? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_... | what are the full names of all left handed players, in order of birth date? |
wta_1 | select t1.country_code , t1.first_name from players as t1 join rankings as t2 on t1.player_id = t2.player_id order by t2.tours desc limit 1 | Question: find the first name and country code of the player who did the most number of tours. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_point... | find the first name and country code of the player who did the most number of tours. |
wta_1 | select t1.country_code , t1.first_name from players as t1 join rankings as t2 on t1.player_id = t2.player_id order by t2.tours desc limit 1 | Question: what is the first name and country code of the player with the most tours? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_s... | what is the first name and country code of the player with the most tours? |
wta_1 | select year from matches group by year order by count(*) desc limit 1 | Question: find the year that has the most number of matches. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes,... | find the year that has the most number of matches. |
wta_1 | select year from matches group by year order by count(*) desc limit 1 | Question: which year had the most matches? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, sur... | which year had the most matches? |
wta_1 | select winner_name , winner_rank_points from matches group by winner_name order by count(*) desc limit 1 | Question: find the name and rank points of the winner who won the most times. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, ma... | find the name and rank points of the winner who won the most times. |
wta_1 | select winner_name , winner_rank_points from matches group by winner_name order by count(*) desc limit 1 | Question: what is the name of the winner who has won the most matches, and how many rank points does this player have? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, lose... | what is the name of the winner who has won the most matches, and how many rank points does this player have? |
wta_1 | select winner_name from matches where tourney_name = 'australian open' order by winner_rank_points desc limit 1 | Question: find the name of the winner who has the highest rank points and participated in the australian open tourney. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, lose... | find the name of the winner who has the highest rank points and participated in the australian open tourney. |
wta_1 | select winner_name from matches where tourney_name = 'australian open' order by winner_rank_points desc limit 1 | Question: what is the name of the winner with the most rank points who participated in the australian open tournament? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, lose... | what is the name of the winner with the most rank points who participated in the australian open tournament? |
wta_1 | select winner_name , loser_name from matches order by minutes desc limit 1 | Question: find the names of loser and winner who played in the match with greatest number of minutes. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_ran... | find the names of loser and winner who played in the match with greatest number of minutes. |
wta_1 | select winner_name , loser_name from matches order by minutes desc limit 1 | Question: what are the names of the winner and loser who played in the longest match? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_... | what are the names of the winner and loser who played in the longest match? |
wta_1 | select avg(ranking) , t1.first_name from players as t1 join rankings as t2 on t1.player_id = t2.player_id group by t1.first_name | Question: find the average ranking for each player and their first name. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_n... | find the average ranking for each player and their first name. |
wta_1 | select avg(ranking) , t1.first_name from players as t1 join rankings as t2 on t1.player_id = t2.player_id group by t1.first_name | Question: what are the first names of all players, and their average rankings? | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, m... | what are the first names of all players, and their average rankings? |
wta_1 | select sum(ranking_points) , t1.first_name from players as t1 join rankings as t2 on t1.player_id = t2.player_id group by t1.first_name | Question: find the total ranking points for each player and their first name. | Tables: players -> player_id, first_name, last_name, hand, birth_date, country_code. matches -> best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, ma... | find the total ranking points for each player and their first name. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.