nl stringlengths 22 185 | sql stringlengths 22 608 | db_id stringclasses 40
values | table_schema stringclasses 305
values |
|---|---|---|---|
What are the dates of the exams whose subject code contains the substring "data"? Return them in descending order of dates. | SELECT Exam_Date FROM Exams WHERE Subject_Code LIKE '%data%' ORDER BY Exam_Date DESC | online_exams | [{'table_name': 'exams', 'table_schema': [{'col_name': 'exam id'}, {'col_name': 'subject code'}, {'col_name': 'exam date'}, {'col_name': 'exam name'}], 'foreign_key_columns': [], 'primary_keys': ['exam id']}] |
What are the type of questions and their counts? | SELECT Type_of_Question_Code , COUNT(*) FROM Questions GROUP BY Type_of_Question_Code | online_exams | [{'table_name': 'questions', 'table_schema': [{'col_name': 'question id'}, {'col_name': 'type of question code'}, {'col_name': 'question text'}], 'foreign_key_columns': [], 'primary_keys': ['question id']}] |
For each question type, return its type code and its count of occurrence. | SELECT Type_of_Question_Code , COUNT(*) FROM Questions GROUP BY Type_of_Question_Code | online_exams | [{'table_name': 'questions', 'table_schema': [{'col_name': 'question id'}, {'col_name': 'type of question code'}, {'col_name': 'question text'}], 'foreign_key_columns': [], 'primary_keys': ['question id']}] |
What are the distinct student answer texts that received comments "Normal"? | SELECT DISTINCT Student_Answer_Text FROM Student_Answers WHERE Comments = "Normal" | online_exams | [{'table_name': 'student answers', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'exam id'}, {'col_name': 'question id'}, {'col_name': 'student id'}, {'col_name': 'date of answer'}, {'col_name': 'comments'}, {'col_name': 'satisfactory yn'}, {'col_name': 'student answer text'}], 'foreign_key_columns': ['exam id', 'question id', 'student id'], 'primary_keys': ['student answer id']}] |
List all the distinct student answer texts to which comments "Normal" were given? | SELECT DISTINCT Student_Answer_Text FROM Student_Answers WHERE Comments = "Normal" | online_exams | [{'table_name': 'student answers', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'exam id'}, {'col_name': 'question id'}, {'col_name': 'student id'}, {'col_name': 'date of answer'}, {'col_name': 'comments'}, {'col_name': 'satisfactory yn'}, {'col_name': 'student answer text'}], 'foreign_key_columns': ['exam id', 'question id', 'student id'], 'primary_keys': ['student answer id']}] |
How many different comments are there for student answers? | SELECT count(DISTINCT Comments) FROM Student_Answers | online_exams | [{'table_name': 'student answers', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'exam id'}, {'col_name': 'question id'}, {'col_name': 'student id'}, {'col_name': 'date of answer'}, {'col_name': 'comments'}, {'col_name': 'satisfactory yn'}, {'col_name': 'student answer text'}], 'foreign_key_columns': ['exam id', 'question id', 'student id'], 'primary_keys': ['student answer id']}] |
Count the number of different comments for student answers. | SELECT count(DISTINCT Comments) FROM Student_Answers | online_exams | [{'table_name': 'student answers', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'exam id'}, {'col_name': 'question id'}, {'col_name': 'student id'}, {'col_name': 'date of answer'}, {'col_name': 'comments'}, {'col_name': 'satisfactory yn'}, {'col_name': 'student answer text'}], 'foreign_key_columns': ['exam id', 'question id', 'student id'], 'primary_keys': ['student answer id']}] |
List all the student answer texts in descending order of count. | SELECT Student_Answer_Text FROM Student_Answers GROUP BY Student_Answer_Text ORDER BY COUNT(*) DESC | online_exams | [{'table_name': 'student answers', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'exam id'}, {'col_name': 'question id'}, {'col_name': 'student id'}, {'col_name': 'date of answer'}, {'col_name': 'comments'}, {'col_name': 'satisfactory yn'}, {'col_name': 'student answer text'}], 'foreign_key_columns': ['exam id', 'question id', 'student id'], 'primary_keys': ['student answer id']}] |
Sort the student answer texts in descending order of their frequency of occurrence. | SELECT Student_Answer_Text FROM Student_Answers GROUP BY Student_Answer_Text ORDER BY COUNT(*) DESC | online_exams | [{'table_name': 'student answers', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'exam id'}, {'col_name': 'question id'}, {'col_name': 'student id'}, {'col_name': 'date of answer'}, {'col_name': 'comments'}, {'col_name': 'satisfactory yn'}, {'col_name': 'student answer text'}], 'foreign_key_columns': ['exam id', 'question id', 'student id'], 'primary_keys': ['student answer id']}] |
Please show the first names of students and the dates of their answers. | SELECT T2.First_Name , T1.Date_of_Answer FROM Student_Answers AS T1 JOIN Students AS T2 ON T1.Student_ID = T2.Student_ID | online_exams | [{'table_name': 'students', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'first name'}, {'col_name': 'middle name'}, {'col_name': 'last name'}, {'col_name': 'gender mfu'}, {'col_name': 'student address'}, {'col_name': 'email adress'}, {'col_name': 'cell mobile phone'}, {'col_name': 'home phone'}], 'foreign_key_columns': [], 'primary_keys': ['student id']}, {'table_name': 'student answers', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'exam id'}, {'col_name': 'question id'}, {'col_name': 'student id'}, {'col_name': 'date of answer'}, {'col_name': 'comments'}, {'col_name': 'satisfactory yn'}, {'col_name': 'student answer text'}], 'foreign_key_columns': ['exam id', 'question id', 'student id'], 'primary_keys': ['student answer id']}] |
For each student answer, find the first name of the student and the date of the answer. | SELECT T2.First_Name , T1.Date_of_Answer FROM Student_Answers AS T1 JOIN Students AS T2 ON T1.Student_ID = T2.Student_ID | online_exams | [{'table_name': 'students', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'first name'}, {'col_name': 'middle name'}, {'col_name': 'last name'}, {'col_name': 'gender mfu'}, {'col_name': 'student address'}, {'col_name': 'email adress'}, {'col_name': 'cell mobile phone'}, {'col_name': 'home phone'}], 'foreign_key_columns': [], 'primary_keys': ['student id']}, {'table_name': 'student answers', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'exam id'}, {'col_name': 'question id'}, {'col_name': 'student id'}, {'col_name': 'date of answer'}, {'col_name': 'comments'}, {'col_name': 'satisfactory yn'}, {'col_name': 'student answer text'}], 'foreign_key_columns': ['exam id', 'question id', 'student id'], 'primary_keys': ['student answer id']}] |
Please show the email addresses of students and the dates of their answers in descending order of dates. | SELECT T2.Email_Adress , T1.Date_of_Answer FROM Student_Answers AS T1 JOIN Students AS T2 ON T1.Student_ID = T2.Student_ID ORDER BY T1.Date_of_Answer DESC | online_exams | [{'table_name': 'students', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'first name'}, {'col_name': 'middle name'}, {'col_name': 'last name'}, {'col_name': 'gender mfu'}, {'col_name': 'student address'}, {'col_name': 'email adress'}, {'col_name': 'cell mobile phone'}, {'col_name': 'home phone'}], 'foreign_key_columns': [], 'primary_keys': ['student id']}, {'table_name': 'student answers', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'exam id'}, {'col_name': 'question id'}, {'col_name': 'student id'}, {'col_name': 'date of answer'}, {'col_name': 'comments'}, {'col_name': 'satisfactory yn'}, {'col_name': 'student answer text'}], 'foreign_key_columns': ['exam id', 'question id', 'student id'], 'primary_keys': ['student answer id']}] |
For each student answer, find the email address of the student and the date of the answer. Sort them in descending order of dates. | SELECT T2.Email_Adress , T1.Date_of_Answer FROM Student_Answers AS T1 JOIN Students AS T2 ON T1.Student_ID = T2.Student_ID ORDER BY T1.Date_of_Answer DESC | online_exams | [{'table_name': 'students', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'first name'}, {'col_name': 'middle name'}, {'col_name': 'last name'}, {'col_name': 'gender mfu'}, {'col_name': 'student address'}, {'col_name': 'email adress'}, {'col_name': 'cell mobile phone'}, {'col_name': 'home phone'}], 'foreign_key_columns': [], 'primary_keys': ['student id']}, {'table_name': 'student answers', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'exam id'}, {'col_name': 'question id'}, {'col_name': 'student id'}, {'col_name': 'date of answer'}, {'col_name': 'comments'}, {'col_name': 'satisfactory yn'}, {'col_name': 'student answer text'}], 'foreign_key_columns': ['exam id', 'question id', 'student id'], 'primary_keys': ['student answer id']}] |
Please show the least common assessment for students. | SELECT Assessment FROM Student_Assessments GROUP BY Assessment ORDER BY COUNT(*) ASC LIMIT 1 | online_exams | [{'table_name': 'student assessments', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'valid answer id'}, {'col_name': 'student answer text'}, {'col_name': 'satisfactory yn'}, {'col_name': 'assessment'}], 'foreign_key_columns': ['valid answer id'], 'primary_keys': ['student answer id']}] |
Which assessment has the smallest frequency count? | SELECT Assessment FROM Student_Assessments GROUP BY Assessment ORDER BY COUNT(*) ASC LIMIT 1 | online_exams | [{'table_name': 'student assessments', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'valid answer id'}, {'col_name': 'student answer text'}, {'col_name': 'satisfactory yn'}, {'col_name': 'assessment'}], 'foreign_key_columns': ['valid answer id'], 'primary_keys': ['student answer id']}] |
Please show the first names of the students that have at least two answer records. | SELECT T2.First_Name FROM Student_Answers AS T1 JOIN Students AS T2 ON T1.Student_ID = T2.Student_ID GROUP BY T1.Student_ID HAVING COUNT(*) >= 2 | online_exams | [{'table_name': 'students', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'first name'}, {'col_name': 'middle name'}, {'col_name': 'last name'}, {'col_name': 'gender mfu'}, {'col_name': 'student address'}, {'col_name': 'email adress'}, {'col_name': 'cell mobile phone'}, {'col_name': 'home phone'}], 'foreign_key_columns': [], 'primary_keys': ['student id']}, {'table_name': 'student answers', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'exam id'}, {'col_name': 'question id'}, {'col_name': 'student id'}, {'col_name': 'date of answer'}, {'col_name': 'comments'}, {'col_name': 'satisfactory yn'}, {'col_name': 'student answer text'}], 'foreign_key_columns': ['exam id', 'question id', 'student id'], 'primary_keys': ['student answer id']}] |
Which students have 2 or more answer records? Give me their first names. | SELECT T2.First_Name FROM Student_Answers AS T1 JOIN Students AS T2 ON T1.Student_ID = T2.Student_ID GROUP BY T1.Student_ID HAVING COUNT(*) >= 2 | online_exams | [{'table_name': 'students', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'first name'}, {'col_name': 'middle name'}, {'col_name': 'last name'}, {'col_name': 'gender mfu'}, {'col_name': 'student address'}, {'col_name': 'email adress'}, {'col_name': 'cell mobile phone'}, {'col_name': 'home phone'}], 'foreign_key_columns': [], 'primary_keys': ['student id']}, {'table_name': 'student answers', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'exam id'}, {'col_name': 'question id'}, {'col_name': 'student id'}, {'col_name': 'date of answer'}, {'col_name': 'comments'}, {'col_name': 'satisfactory yn'}, {'col_name': 'student answer text'}], 'foreign_key_columns': ['exam id', 'question id', 'student id'], 'primary_keys': ['student answer id']}] |
What is the most common valid answer text? | SELECT Valid_Answer_Text FROM Valid_Answers GROUP BY Valid_Answer_Text ORDER BY COUNT(*) DESC LIMIT 1 | online_exams | [{'table_name': 'valid answers', 'table_schema': [{'col_name': 'valid answer id'}, {'col_name': 'question id'}, {'col_name': 'valid answer text'}], 'foreign_key_columns': ['question id'], 'primary_keys': ['valid answer id']}] |
Find the valid answer text that appeared most frequently. | SELECT Valid_Answer_Text FROM Valid_Answers GROUP BY Valid_Answer_Text ORDER BY COUNT(*) DESC LIMIT 1 | online_exams | [{'table_name': 'valid answers', 'table_schema': [{'col_name': 'valid answer id'}, {'col_name': 'question id'}, {'col_name': 'valid answer text'}], 'foreign_key_columns': ['question id'], 'primary_keys': ['valid answer id']}] |
List the last names of the students whose gender is not "M". | SELECT Last_Name FROM Students WHERE Gender_MFU != "M" | online_exams | [{'table_name': 'students', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'first name'}, {'col_name': 'middle name'}, {'col_name': 'last name'}, {'col_name': 'gender mfu'}, {'col_name': 'student address'}, {'col_name': 'email adress'}, {'col_name': 'cell mobile phone'}, {'col_name': 'home phone'}], 'foreign_key_columns': [], 'primary_keys': ['student id']}] |
What are the last names of the students with gender other than "M"? | SELECT Last_Name FROM Students WHERE Gender_MFU != "M" | online_exams | [{'table_name': 'students', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'first name'}, {'col_name': 'middle name'}, {'col_name': 'last name'}, {'col_name': 'gender mfu'}, {'col_name': 'student address'}, {'col_name': 'email adress'}, {'col_name': 'cell mobile phone'}, {'col_name': 'home phone'}], 'foreign_key_columns': [], 'primary_keys': ['student id']}] |
List each gender and the corresponding number of students. | SELECT Gender_MFU , COUNT(*) FROM Students GROUP BY Gender_MFU | online_exams | [{'table_name': 'students', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'first name'}, {'col_name': 'middle name'}, {'col_name': 'last name'}, {'col_name': 'gender mfu'}, {'col_name': 'student address'}, {'col_name': 'email adress'}, {'col_name': 'cell mobile phone'}, {'col_name': 'home phone'}], 'foreign_key_columns': [], 'primary_keys': ['student id']}] |
For each gender, return the gender code and the number of students who identify as that gender. | SELECT Gender_MFU , COUNT(*) FROM Students GROUP BY Gender_MFU | online_exams | [{'table_name': 'students', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'first name'}, {'col_name': 'middle name'}, {'col_name': 'last name'}, {'col_name': 'gender mfu'}, {'col_name': 'student address'}, {'col_name': 'email adress'}, {'col_name': 'cell mobile phone'}, {'col_name': 'home phone'}], 'foreign_key_columns': [], 'primary_keys': ['student id']}] |
List the last names of the students whose gender is "F" or "M". | SELECT Last_Name FROM Students WHERE Gender_MFU = "F" OR Gender_MFU = "M" | online_exams | [{'table_name': 'students', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'first name'}, {'col_name': 'middle name'}, {'col_name': 'last name'}, {'col_name': 'gender mfu'}, {'col_name': 'student address'}, {'col_name': 'email adress'}, {'col_name': 'cell mobile phone'}, {'col_name': 'home phone'}], 'foreign_key_columns': [], 'primary_keys': ['student id']}] |
Which students identify their gender as "F" or "M"? Give me their last names. | SELECT Last_Name FROM Students WHERE Gender_MFU = "F" OR Gender_MFU = "M" | online_exams | [{'table_name': 'students', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'first name'}, {'col_name': 'middle name'}, {'col_name': 'last name'}, {'col_name': 'gender mfu'}, {'col_name': 'student address'}, {'col_name': 'email adress'}, {'col_name': 'cell mobile phone'}, {'col_name': 'home phone'}], 'foreign_key_columns': [], 'primary_keys': ['student id']}] |
List the first names of the students who do not have any answers. | SELECT First_Name FROM Students WHERE Student_ID NOT IN (SELECT Student_ID FROM Student_Answers) | online_exams | [{'table_name': 'students', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'first name'}, {'col_name': 'middle name'}, {'col_name': 'last name'}, {'col_name': 'gender mfu'}, {'col_name': 'student address'}, {'col_name': 'email adress'}, {'col_name': 'cell mobile phone'}, {'col_name': 'home phone'}], 'foreign_key_columns': [], 'primary_keys': ['student id']}, {'table_name': 'student answers', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'exam id'}, {'col_name': 'question id'}, {'col_name': 'student id'}, {'col_name': 'date of answer'}, {'col_name': 'comments'}, {'col_name': 'satisfactory yn'}, {'col_name': 'student answer text'}], 'foreign_key_columns': ['exam id', 'question id', 'student id'], 'primary_keys': ['student answer id']}] |
Which students do not have any answers? Find their first names. | SELECT First_Name FROM Students WHERE Student_ID NOT IN (SELECT Student_ID FROM Student_Answers) | online_exams | [{'table_name': 'students', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'first name'}, {'col_name': 'middle name'}, {'col_name': 'last name'}, {'col_name': 'gender mfu'}, {'col_name': 'student address'}, {'col_name': 'email adress'}, {'col_name': 'cell mobile phone'}, {'col_name': 'home phone'}], 'foreign_key_columns': [], 'primary_keys': ['student id']}, {'table_name': 'student answers', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'exam id'}, {'col_name': 'question id'}, {'col_name': 'student id'}, {'col_name': 'date of answer'}, {'col_name': 'comments'}, {'col_name': 'satisfactory yn'}, {'col_name': 'student answer text'}], 'foreign_key_columns': ['exam id', 'question id', 'student id'], 'primary_keys': ['student answer id']}] |
Show the student answer texts that received both "Normal" and "Absent" as comments. | SELECT Student_Answer_Text FROM Student_Answers WHERE Comments = "Normal" INTERSECT SELECT Student_Answer_Text FROM Student_Answers WHERE Comments = "Absent" | online_exams | [{'table_name': 'student answers', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'exam id'}, {'col_name': 'question id'}, {'col_name': 'student id'}, {'col_name': 'date of answer'}, {'col_name': 'comments'}, {'col_name': 'satisfactory yn'}, {'col_name': 'student answer text'}], 'foreign_key_columns': ['exam id', 'question id', 'student id'], 'primary_keys': ['student answer id']}] |
Which student answer texts were given both "Normal" and "Absent" as comments? | SELECT Student_Answer_Text FROM Student_Answers WHERE Comments = "Normal" INTERSECT SELECT Student_Answer_Text FROM Student_Answers WHERE Comments = "Absent" | online_exams | [{'table_name': 'student answers', 'table_schema': [{'col_name': 'student answer id'}, {'col_name': 'exam id'}, {'col_name': 'question id'}, {'col_name': 'student id'}, {'col_name': 'date of answer'}, {'col_name': 'comments'}, {'col_name': 'satisfactory yn'}, {'col_name': 'student answer text'}], 'foreign_key_columns': ['exam id', 'question id', 'student id'], 'primary_keys': ['student answer id']}] |
Show the types of questions that have at least three questions. | SELECT Type_of_Question_Code FROM Questions GROUP BY Type_of_Question_Code HAVING count(*) >= 3 | online_exams | [{'table_name': 'questions', 'table_schema': [{'col_name': 'question id'}, {'col_name': 'type of question code'}, {'col_name': 'question text'}], 'foreign_key_columns': [], 'primary_keys': ['question id']}] |
Which types of questions have 3 or more questions? Return the questions type code. | SELECT Type_of_Question_Code FROM Questions GROUP BY Type_of_Question_Code HAVING count(*) >= 3 | online_exams | [{'table_name': 'questions', 'table_schema': [{'col_name': 'question id'}, {'col_name': 'type of question code'}, {'col_name': 'question text'}], 'foreign_key_columns': [], 'primary_keys': ['question id']}] |
Show all information on students. | SELECT * FROM Students | online_exams | [{'table_name': 'students', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'first name'}, {'col_name': 'middle name'}, {'col_name': 'last name'}, {'col_name': 'gender mfu'}, {'col_name': 'student address'}, {'col_name': 'email adress'}, {'col_name': 'cell mobile phone'}, {'col_name': 'home phone'}], 'foreign_key_columns': [], 'primary_keys': ['student id']}] |
What is al the available information of each student? | SELECT * FROM Students | online_exams | [{'table_name': 'students', 'table_schema': [{'col_name': 'student id'}, {'col_name': 'first name'}, {'col_name': 'middle name'}, {'col_name': 'last name'}, {'col_name': 'gender mfu'}, {'col_name': 'student address'}, {'col_name': 'email adress'}, {'col_name': 'cell mobile phone'}, {'col_name': 'home phone'}], 'foreign_key_columns': [], 'primary_keys': ['student id']}] |
How many addresses do we have? | SELECT count(*) FROM Addresses | customers_and_orders | [{'table_name': 'addresses', 'table_schema': [{'col_name': 'address id'}, {'col_name': 'address details'}], 'foreign_key_columns': [], 'primary_keys': ['address id']}] |
Count the number of addresses. | SELECT count(*) FROM Addresses | customers_and_orders | [{'table_name': 'addresses', 'table_schema': [{'col_name': 'address id'}, {'col_name': 'address details'}], 'foreign_key_columns': [], 'primary_keys': ['address id']}] |
List all address ids and address details. | SELECT address_id , address_details FROM Addresses | customers_and_orders | [{'table_name': 'addresses', 'table_schema': [{'col_name': 'address id'}, {'col_name': 'address details'}], 'foreign_key_columns': [], 'primary_keys': ['address id']}] |
What are all the address ids and address details? | SELECT address_id , address_details FROM Addresses | customers_and_orders | [{'table_name': 'addresses', 'table_schema': [{'col_name': 'address id'}, {'col_name': 'address details'}], 'foreign_key_columns': [], 'primary_keys': ['address id']}] |
How many products do we have? | SELECT count(*) FROM Products | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
Count the number of products. | SELECT count(*) FROM Products | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
Show all product ids, product type codes, and product name. | SELECT product_id , product_type_code , product_name FROM Products | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What are the ids, type codes, and names for all products? | SELECT product_id , product_type_code , product_name FROM Products | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What is the price for the product with name Monitor? | SELECT product_price FROM Products WHERE product_name = "Monitor" | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
Give the price of the Monitor product. | SELECT product_price FROM Products WHERE product_name = "Monitor" | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
Show the minimum, average, maximum price for all products. | SELECT min(product_price) , avg(product_price) , max(product_price) FROM Products | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What are the minimum, average, and maximum prices across all products? | SELECT min(product_price) , avg(product_price) , max(product_price) FROM Products | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What is the average price for products with type Clothes? | SELECT avg(product_price) FROM Products WHERE product_type_code = "Clothes" | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
Return the average price of Clothes. | SELECT avg(product_price) FROM Products WHERE product_type_code = "Clothes" | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
How many hardware type products do we have? | SELECT count(*) FROM Products WHERE product_type_code = "Hardware" | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
Count the number of products of the type Hardware. | SELECT count(*) FROM Products WHERE product_type_code = "Hardware" | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
Show all product names with price higher than the average. | SELECT product_name FROM Products WHERE product_price > (SELECT avg(product_price) FROM Products) | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What are the names of products that have a price above the average for all products. | SELECT product_name FROM Products WHERE product_price > (SELECT avg(product_price) FROM Products) | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
Show all hardware product names with price higher than the average price of hardware type products. | SELECT product_name FROM Products WHERE product_type_code = "Hardware" AND product_price > (SELECT avg(product_price) FROM Products WHERE product_type_code = "Hardware") | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What are the names of Hardware product with prices above the average price of Hardware products. | SELECT product_name FROM Products WHERE product_type_code = "Hardware" AND product_price > (SELECT avg(product_price) FROM Products WHERE product_type_code = "Hardware") | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What is the name of the most expensive product with type Clothes? | SELECT product_name FROM Products WHERE product_type_code = "Clothes" ORDER BY product_price DESC LIMIT 1 | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
Give the name of the most expensive Clothes product. | SELECT product_name FROM Products WHERE product_type_code = "Clothes" ORDER BY product_price DESC LIMIT 1 | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What is the product id and product name for the cheapest Hardware type product? | SELECT product_id , product_name FROM Products WHERE product_type_code = "Hardware" ORDER BY product_price ASC LIMIT 1 | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
Give the id and name of the cheapest Hardware product. | SELECT product_id , product_name FROM Products WHERE product_type_code = "Hardware" ORDER BY product_price ASC LIMIT 1 | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
List all product names in descending order of price. | SELECT product_name FROM Products ORDER BY product_price DESC | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What are the names of the products, sorted by descending price? | SELECT product_name FROM Products ORDER BY product_price DESC | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
Show all hardware type products in ascending order of price. | SELECT product_name FROM Products WHERE product_type_code = "Hardware" ORDER BY product_price ASC | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What are the names of all Hardware products, sorted by price ascending? | SELECT product_name FROM Products WHERE product_type_code = "Hardware" ORDER BY product_price ASC | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
List all product type codes and the number of products in each type. | SELECT product_type_code , count(*) FROM Products GROUP BY product_type_code | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
How many products are there for each product type? | SELECT product_type_code , count(*) FROM Products GROUP BY product_type_code | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
Show all product type codes and the average price for each type. | SELECT product_type_code , avg(product_price) FROM Products GROUP BY product_type_code | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What is the average price of products for each product type? | SELECT product_type_code , avg(product_price) FROM Products GROUP BY product_type_code | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What are the product type code with at least two products? | SELECT product_type_code FROM Products GROUP BY product_type_code HAVING count(*) >= 2 | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
Give the product type codes of product types that have two or more products. | SELECT product_type_code FROM Products GROUP BY product_type_code HAVING count(*) >= 2 | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What is the product type code with most number of products? | SELECT product_type_code FROM Products GROUP BY product_type_code ORDER BY count(*) DESC LIMIT 1 | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What is the most frequent product type code? | SELECT product_type_code FROM Products GROUP BY product_type_code ORDER BY count(*) DESC LIMIT 1 | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
How many customers do we have? | SELECT count(*) FROM Customers | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}] |
Count the number of customers. | SELECT count(*) FROM Customers | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}] |
Show all customer ids and customer names. | SELECT customer_id , customer_name FROM Customers | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}] |
What are the ids and names of all customers? | SELECT customer_id , customer_name FROM Customers | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}] |
What is the customer address, customer phone, and customer email for Jeromy? | SELECT customer_address , customer_phone , customer_email FROM Customers WHERE customer_name = "Jeromy" | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}] |
Give the address, phone, and email for customers with the name Jeromy. | SELECT customer_address , customer_phone , customer_email FROM Customers WHERE customer_name = "Jeromy" | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}] |
Show all payment method codes and the number of customers in each code. | SELECT payment_method_code , count(*) FROM Customers GROUP BY payment_method_code | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}] |
How many customers use each payment method? | SELECT payment_method_code , count(*) FROM Customers GROUP BY payment_method_code | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}] |
What is the payment method code used by most number of customers? | SELECT payment_method_code FROM Customers GROUP BY payment_method_code ORDER BY count(*) DESC LIMIT 1 | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}] |
Give the code of the payment method that is most commonly used. | SELECT payment_method_code FROM Customers GROUP BY payment_method_code ORDER BY count(*) DESC LIMIT 1 | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}] |
Show all customer names with the payment method code used by least number of customers. | SELECT customer_name FROM Customers WHERE payment_method_code = ( SELECT payment_method_code FROM Customers GROUP BY payment_method_code ORDER BY count(*) ASC LIMIT 1) | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}] |
What are the names of customers who use the least common payment method? | SELECT customer_name FROM Customers WHERE payment_method_code = ( SELECT payment_method_code FROM Customers GROUP BY payment_method_code ORDER BY count(*) ASC LIMIT 1) | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}] |
What is the payment method and customer number for customer named Jeromy? | SELECT payment_method_code , customer_number FROM Customers WHERE customer_name = "Jeromy" | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}] |
Give the payment method code and customer number corresponding to the customer named Jeromy. | SELECT payment_method_code , customer_number FROM Customers WHERE customer_name = "Jeromy" | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}] |
What are the distinct payment methods used by customers? | SELECT DISTINCT payment_method_code FROM Customers | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}] |
Give the different payment method codes that customers use. | SELECT DISTINCT payment_method_code FROM Customers | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}] |
Show the id and the product type for all products, order by product name. | SELECT product_id , product_type_code FROM Products ORDER BY product_name | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What are the ids and product types for all products, sorted alphabetically by product name? | SELECT product_id , product_type_code FROM Products ORDER BY product_name | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What is the product type with least number of products? | SELECT product_type_code FROM Products GROUP BY product_type_code ORDER BY count(*) ASC LIMIT 1 | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
What is the code of the product type that is least common? | SELECT product_type_code FROM Products GROUP BY product_type_code ORDER BY count(*) ASC LIMIT 1 | customers_and_orders | [{'table_name': 'products', 'table_schema': [{'col_name': 'product id'}, {'col_name': 'product type code'}, {'col_name': 'product name'}, {'col_name': 'product price'}], 'foreign_key_columns': [], 'primary_keys': ['product id']}] |
How many customer orders do we have? | SELECT count(*) FROM Customer_orders | customers_and_orders | [{'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}] |
Count the number of customer orders. | SELECT count(*) FROM Customer_orders | customers_and_orders | [{'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}] |
Show the order ids, order dates, and order status codes for all orders by customer Jeromy. | SELECT order_id , order_date , order_status_code FROM Customer_orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_name = "Jeromy" | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}] |
What were the ids, dates, and status codes for orders made by Jeromy? | SELECT order_id , order_date , order_status_code FROM Customer_orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_name = "Jeromy" | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}] |
Show all customer names, ids and the number of orders by each customer. | SELECT T2.customer_name , T1.customer_id , count(*) FROM Customer_orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}] |
What are the names, ids, and number of orders made for each customer? | SELECT T2.customer_name , T1.customer_id , count(*) FROM Customer_orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}] |
What is the customer id, name, phone, and email for the customer with most orders? | SELECT T1.customer_id , T2.customer_name , T2.customer_phone , T2.customer_email FROM Customer_orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1 | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}] |
Give the id, name, phone, and email corresponding to the customer who made the most orders. | SELECT T1.customer_id , T2.customer_name , T2.customer_phone , T2.customer_email FROM Customer_orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1 | customers_and_orders | [{'table_name': 'customers', 'table_schema': [{'col_name': 'customer id'}, {'col_name': 'address id'}, {'col_name': 'payment method code'}, {'col_name': 'customer number'}, {'col_name': 'customer name'}, {'col_name': 'customer address'}, {'col_name': 'customer phone'}, {'col_name': 'customer email'}], 'foreign_key_columns': [], 'primary_keys': ['customer id']}, {'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}] |
Show all order status and the number of orders in each status. | SELECT order_status_code , count(*) FROM Customer_orders GROUP BY order_status_code | customers_and_orders | [{'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}] |
How many orders have each order status code? | SELECT order_status_code , count(*) FROM Customer_orders GROUP BY order_status_code | customers_and_orders | [{'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}] |
What is the order status code that is most common? | SELECT order_status_code FROM Customer_orders GROUP BY order_status_code ORDER BY count(*) DESC LIMIT 1 | customers_and_orders | [{'table_name': 'customer orders', 'table_schema': [{'col_name': 'order id'}, {'col_name': 'customer id'}, {'col_name': 'order date'}, {'col_name': 'order status code'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['order id']}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.