SpiderQuestion stringlengths 16 224 | query stringlengths 18 577 | SpiderSynQuestion stringlengths 19 222 | db_id stringlengths 4 31 |
|---|---|---|---|
Find the numbers of different majors and cities. | SELECT count(DISTINCT major) , count(DISTINCT city_code) FROM student | Find the numbers of different discipline and cities. | dorm_1 |
How many different majors are there and how many different city codes are there for each student? | SELECT count(DISTINCT major) , count(DISTINCT city_code) FROM student | How many different discipline are there and how many different city codes are there for each student? | dorm_1 |
Find the name of dorms which have both TV Lounge and Study Room as amenities. | SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' INTERSECT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'Study Room' | Find the name of dormitories which have both TV Lounge and Study Room as amenities. | dorm_1 |
What is the name of the dorm with both a TV Lounge and Study Room listed as amenities? | SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' INTERSECT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'Study Room' | What is the name of the dormitory with both a TV Lounge and Study Room listed as amenities? | dorm_1 |
Find the name of dorms which have TV Lounge but no Study Room as amenity. | SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' EXCEPT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'Study Room' | Find the name of dormitories which have TV Lounge but no Study Room as amenity. | dorm_1 |
What is the name of each dorm that has a TV Lounge but no study rooms? | SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' EXCEPT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'Study Room' | What is the name of each dormitory that has a TV Lounge but no study rooms? | dorm_1 |
Find the last name of students who is either female (sex is F) and living in the city of code BAL or male (sex is M) and in age of below 20. | SELECT lname FROM student WHERE sex = 'F' AND city_code = 'BAL' UNION SELECT lname FROM student WHERE sex = 'M' AND age < 20 | Find the family name of students who is either female (sex is F) and living in the city of code BAL or male (sex is M) and in age of below 20. | dorm_1 |
What is the last name of every student who is either female or living in a city with the code BAL or male and under 20? | SELECT lname FROM student WHERE sex = 'F' AND city_code = 'BAL' UNION SELECT lname FROM student WHERE sex = 'M' AND age < 20 | What is the family name of every student who is either female or living in a city with the code BAL or male and under 20? | dorm_1 |
Find the name of the dorm with the largest capacity. | SELECT dorm_name FROM dorm ORDER BY student_capacity DESC LIMIT 1 | Find the name of the dormitory with the largest capacity. | dorm_1 |
What are the names of the dorm with the largest capacity? | SELECT dorm_name FROM dorm ORDER BY student_capacity DESC LIMIT 1 | What are the names of the dormitory with the largest capacity? | dorm_1 |
List in alphabetic order all different amenities. | SELECT amenity_name FROM dorm_amenity ORDER BY amenity_name | List in alphabetic order all different amenities. | dorm_1 |
What are the different dorm amenity names in alphabetical order? | SELECT amenity_name FROM dorm_amenity ORDER BY amenity_name | What are the different dormitory amenity names in alphabetical order? | dorm_1 |
Find the code of city where most of students are living in. | SELECT city_code FROM student GROUP BY city_code ORDER BY count(*) DESC LIMIT 1 | Find the code of city where most of students are living in. | dorm_1 |
What is the code of the city with the most students? | SELECT city_code FROM student GROUP BY city_code ORDER BY count(*) DESC LIMIT 1 | What is the code of the city with the most students? | dorm_1 |
Find the first and last name of students whose age is younger than the average age. | SELECT fname , lname FROM student WHERE age < (SELECT avg(age) FROM student) | Find the full name of students whose age is younger than the average age. | dorm_1 |
What is the first and last name of all students who are younger than average? | SELECT fname , lname FROM student WHERE age < (SELECT avg(age) FROM student) | What is the full name of all students who are younger than average? | dorm_1 |
List the first and last name of students who are not living in the city with code HKG, and sorted the results by their ages. | SELECT fname , lname FROM student WHERE city_code != 'HKG' ORDER BY age | List the forename and surname of students who are not living in the city with code HKG, and sorted the results by their ages. | dorm_1 |
What are the first and last names of all students who are not living in the city HKG and order the results by age? | SELECT fname , lname FROM student WHERE city_code != 'HKG' ORDER BY age | What are the full names of all students who are not living in the city HKG and order the results by age? | dorm_1 |
List name of all amenities which Anonymous Donor Hall has, and sort the results in alphabetic order. | SELECT T1.amenity_name FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T2.amenid = T1.amenid JOIN dorm AS T3 ON T2.dormid = T3.dormid WHERE T3.dorm_name = 'Anonymous Donor Hall' ORDER BY T1.amenity_name | List name of all amenities which Anonymous Donor Hall has, and sort the results in alphabetic order. | dorm_1 |
What are the amenities in alphabetical order that Anonymous Donor Hall has? | SELECT T1.amenity_name FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T2.amenid = T1.amenid JOIN dorm AS T3 ON T2.dormid = T3.dormid WHERE T3.dorm_name = 'Anonymous Donor Hall' ORDER BY T1.amenity_name | What are the amenities in alphabetical order that Anonymous Donor Hall has? | dorm_1 |
Find the number of dorms and total capacity for each gender. | SELECT count(*) , sum(student_capacity) , gender FROM dorm GROUP BY gender | Find the number of dormitories and total capacity for each gender. | dorm_1 |
How many dorms are there and what is the total capacity for each gender? | SELECT count(*) , sum(student_capacity) , gender FROM dorm GROUP BY gender | How many dormitories are there and what is the total capacity for each gender? | dorm_1 |
Find the average and oldest age for students with different sex. | SELECT avg(age) , max(age) , sex FROM student GROUP BY sex | Find the average and oldest age for students with different sex. | dorm_1 |
What is the average and oldest age for each gender of student? | SELECT avg(age) , max(age) , sex FROM student GROUP BY sex | What is the average and oldest age for each gender of student? | dorm_1 |
Find the number of students in each major. | SELECT count(*) , major FROM student GROUP BY major | Find the number of students in each discipline. | dorm_1 |
How many students are there in each major? | SELECT count(*) , major FROM student GROUP BY major | How many students are there in each discipline? | dorm_1 |
Find the number and average age of students living in each city. | SELECT count(*) , avg(age) , city_code FROM student GROUP BY city_code | Find the number and average age of students living in each city. | dorm_1 |
How many students live in each city and what are their average ages? | SELECT count(*) , avg(age) , city_code FROM student GROUP BY city_code | How many students live in each city and what are their average ages? | dorm_1 |
Find the average age and number of male students (with sex M) from each city. | SELECT count(*) , avg(age) , city_code FROM student WHERE sex = 'M' GROUP BY city_code | Find the average age and number of male students (with sex M) from each city. | dorm_1 |
What is the average age and how many male students are there in each city? | SELECT count(*) , avg(age) , city_code FROM student WHERE sex = 'M' GROUP BY city_code | What is the average age and how many male students are there in each city? | dorm_1 |
Find the number of students for the cities where have more than one student. | SELECT count(*) , city_code FROM student GROUP BY city_code HAVING count(*) > 1 | Find the number of students for the cities where have more than one student. | dorm_1 |
How many students are from each city, and which cities have more than one cities? | SELECT count(*) , city_code FROM student GROUP BY city_code HAVING count(*) > 1 | How many students are from each city, and which cities have more than one cities? | dorm_1 |
Find the first and last name of students who are not in the largest major. | SELECT fname , lname FROM student WHERE major != (SELECT major FROM student GROUP BY major ORDER BY count(*) DESC LIMIT 1) | Find the forename and family name of students who are not in the largest major. | dorm_1 |
What is the first and last name of the students who are not in the largest major? | SELECT fname , lname FROM student WHERE major != (SELECT major FROM student GROUP BY major ORDER BY count(*) DESC LIMIT 1) | What is the forename and surname of the students who are not in the largest major? | dorm_1 |
Find the number of students whose age is older than the average age for each gender. | SELECT count(*) , sex FROM student WHERE age > (SELECT avg(age) FROM student) GROUP BY sex | Find the number of students whose age is older than the average age for each gender. | dorm_1 |
How many students are older than average for each gender? | SELECT count(*) , sex FROM student WHERE age > (SELECT avg(age) FROM student) GROUP BY sex | How many students are older than average for each gender? | dorm_1 |
Find the average age of students living in each dorm and the name of dorm. | SELECT avg(T1.age) , T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name | Find the average age of students living in each dormitory and the name of dormitory. | dorm_1 |
What is the average age for each dorm and what are the names of each dorm? | SELECT avg(T1.age) , T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name | What is the average age for each dormitory and what are the names of each dormitory? | dorm_1 |
Find the number of amenities for each of the dorms that can accommodate more than 100 students. | SELECT count(*) , T1.dormid FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid WHERE T1.student_capacity > 100 GROUP BY T1.dormid | Find the number of amenities for each of the dormitories that can accommodate more than 100 students. | dorm_1 |
For each dorm, how many amenities does it have? | SELECT count(*) , T1.dormid FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid WHERE T1.student_capacity > 100 GROUP BY T1.dormid | For each dormitory, how many amenities does it have? | dorm_1 |
Find the number of students who is older than 20 in each dorm. | SELECT count(*) , T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T1.age > 20 GROUP BY T3.dorm_name | Find the number of students who is older than 20 in each dormitory. | dorm_1 |
How many students are older than 20 in each dorm? | SELECT count(*) , T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T1.age > 20 GROUP BY T3.dorm_name | How many students are older than 20 in each dormitory? | dorm_1 |
Find the first name of students who are living in the Smith Hall. | SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' | Find the forename of students who are living in the Smith Hall. | dorm_1 |
What are the first names of all students in Smith Hall? | SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' | What are the forenames of all students in Smith Hall? | dorm_1 |
Find the average age of students who are living in the dorm with the largest capacity. | SELECT avg(T1.age) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.student_capacity = (SELECT max(student_capacity) FROM dorm) | Find the average age of students who are living in the dormitory with the largest capacity. | dorm_1 |
What is the average age of students who are living in the dorm with the largest capacity? | SELECT avg(T1.age) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.student_capacity = (SELECT max(student_capacity) FROM dorm) | What is the average age of students who are living in the dormitory with the largest capacity? | dorm_1 |
Find the total number of students living in the male dorm (with gender M). | SELECT count(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.gender = 'M' | Find the total number of students living in the male dorm (with gender M). | dorm_1 |
What are the total number of students who are living in a male dorm? | SELECT count(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.gender = 'M' | What are the total number of students who are living in a male dorm? | dorm_1 |
Find the number of female students (with F sex) living in Smith Hall | SELECT count(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' AND T1.sex = 'F' | Find the number of female students (with F sex) living in Smith Hall | dorm_1 |
How many female students live in Smith Hall? | SELECT count(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' AND T1.sex = 'F' | How many female students live in Smith Hall? | dorm_1 |
Find the name of amenities Smith Hall dorm have. | SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' | Find the name of amenities Smith Hall dorm have. | dorm_1 |
What are the names of the amenities that Smith Hall has? | SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' | What are the names of the amenities that Smith Hall has? | dorm_1 |
Find the name of amenities Smith Hall dorm have. ordered the results by amenity names. | SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' ORDER BY T3.amenity_name | Find the name of amenities Smith Hall dorm have. ordered the results by amenity names. | dorm_1 |
What amenities does Smith Hall have in alphabetical order? | SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' ORDER BY T3.amenity_name | What amenities does Smith Hall have in alphabetical order? | dorm_1 |
Find the name of amenity that is most common in all dorms. | SELECT T1.amenity_name FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T1.amenid = T2.amenid GROUP BY T2.amenid ORDER BY count(*) DESC LIMIT 1 | Find the name of amenity that is most common in all dormitories. | dorm_1 |
What is the most common amenity in the dorms? | SELECT T1.amenity_name FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T1.amenid = T2.amenid GROUP BY T2.amenid ORDER BY count(*) DESC LIMIT 1 | What is the most common amenity in the dormitories? | dorm_1 |
Find the first name of students who are living in the dorm that has most number of amenities. | SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T2.dormid FROM dorm AS T3 JOIN has_amenity AS T4 ON T3.dormid = T4.dormid JOIN dorm_amenity AS T5 ON T4.amenid = T5.amenid GROUP BY T3.dormid ORDER BY count(*) DESC LIMIT 1) | Find the forename of students who are living in the dorm that has most number of amenities. | dorm_1 |
What are the first names of all students who live in the dorm with the most amenities? | SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T2.dormid FROM dorm AS T3 JOIN has_amenity AS T4 ON T3.dormid = T4.dormid JOIN dorm_amenity AS T5 ON T4.amenid = T5.amenid GROUP BY T3.dormid ORDER BY count(*) DESC LIMIT 1) | What are the forenames of all students who live in the dorm with the most amenities? | dorm_1 |
Find the name and capacity of the dorm with least number of amenities. | SELECT T1.dorm_name , T1.student_capacity FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid GROUP BY T2.dormid ORDER BY count(*) LIMIT 1 | Find the name and capacity of the dormitory with least number of amenities. | dorm_1 |
What is the name and capacity of the dorm with the fewest amount of amenities? | SELECT T1.dorm_name , T1.student_capacity FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid GROUP BY T2.dormid ORDER BY count(*) LIMIT 1 | What is the name and capacity of the dormitory with the fewest amount of amenities? | dorm_1 |
Find the name of dorms that do not have amenity TV Lounge. | SELECT dorm_name FROM dorm EXCEPT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' | Find the name of dormitories that do not have amenity TV Lounge. | dorm_1 |
What are the names of the dorm that does not have a TV Lounge? | SELECT dorm_name FROM dorm EXCEPT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' | What are the names of the dormitory that does not have a TV Lounge? | dorm_1 |
Find the first and last name of students who are living in the dorms that have amenity TV Lounge. | SELECT T1.fname , T1.lname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge') | Find the full name of students who are living in the dorms that have amenity TV Lounge. | dorm_1 |
What are the first and last names of all students who are living in a dorm with a TV Lounge? | SELECT T1.fname , T1.lname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge') | What are the forename and family names of all students who are living in a dorm with a TV Lounge? | dorm_1 |
Find the first name and age of students who are living in the dorms that do not have amenity TV Lounge. | SELECT T1.fname , T1.age FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid NOT IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge') | Find the forename and age of students who are living in the dorms that do not have amenity TV Lounge. | dorm_1 |
What is the first name and age of every student who lives in a dorm with a TV Lounge? | SELECT T1.fname , T1.age FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid NOT IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge') | What is the forename and age of every student who lives in a dorm with a TV Lounge? | dorm_1 |
Find the name of amenities of the dorm where the student with last name Smith is living in. | SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid JOIN lives_in AS T4 ON T4.dormid = T1.dormid JOIN student AS T5 ON T5.stuid = T4.stuid WHERE T5.lname = 'Smith' | Find the name of amenities of the dormitory where the student with last name Smith is living in. | dorm_1 |
What are the amenities in the dorm that a student who has the last name of Smith lives in? | SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid JOIN lives_in AS T4 ON T4.dormid = T1.dormid JOIN student AS T5 ON T5.stuid = T4.stuid WHERE T5.lname = 'Smith' | What are the amenities in the dormitory that a student who has the last name of Smith lives in? | dorm_1 |
How many customers are there? | SELECT count(*) FROM customers | How many clients are there? | customer_complaints |
Count the number of customers. | SELECT count(*) FROM customers | Count the number of clients. | customer_complaints |
Find the emails and phone numbers of all the customers, ordered by email address and phone number. | SELECT email_address , phone_number FROM customers ORDER BY email_address , phone_number | Find the emails and telephone numbers of all the clients, ordered by email address and telephone number. | customer_complaints |
What are the emails and phone numbers of all customers, sorted by email address and phone number? | SELECT email_address , phone_number FROM customers ORDER BY email_address , phone_number | What are the emails and telephone numbers of all clients, sorted by email address and telephone number? | customer_complaints |
Which city has the least number of customers whose type code is "Good Credit Rating"? | SELECT town_city FROM customers WHERE customer_type_code = "Good Credit Rating" GROUP BY town_city ORDER BY count(*) LIMIT 1 | Which city has the least number of clients whose type code is "Good Credit Rating"? | customer_complaints |
Return the city with the customer type code "Good Credit Rating" that had the fewest customers. | SELECT town_city FROM customers WHERE customer_type_code = "Good Credit Rating" GROUP BY town_city ORDER BY count(*) LIMIT 1 | Return the city with the client type code "Good Credit Rating" that had the fewest clients. | customer_complaints |
List the name of all products along with the number of complaints that they have received. | SELECT t1.product_name , count(*) FROM products AS t1 JOIN complaints AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_name | List the name of all goods along with the number of complaints that they have received. | customer_complaints |
What are all the different product names, and how many complains has each received? | SELECT t1.product_name , count(*) FROM products AS t1 JOIN complaints AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_name | What are all the different goods names, and how many complains has each received? | customer_complaints |
Find the emails of customers who has filed a complaints of the product with the most complaints. | SELECT t1.email_address FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id ORDER BY count(*) LIMIT 1 | Find the emails of clients who has filed a complaints of the goods with the most complaints. | customer_complaints |
What are the emails of customers who have filed complaints on the product which has had the greatest number of complaints? | SELECT t1.email_address FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id ORDER BY count(*) LIMIT 1 | What are the emails of clients who have filed complaints on the goods which has had the greatest number of complaints? | customer_complaints |
Which products has been complained by the customer who has filed least amount of complaints? | SELECT DISTINCT t1.product_name FROM products AS t1 JOIN complaints AS t2 ON t1.product_id = t2.product_id JOIN customers AS t3 GROUP BY t3.customer_id ORDER BY count(*) LIMIT 1 | Which goods has been complained by the customer who has filed least amount of complaints? | customer_complaints |
Return the names of products that have had complaints filed by the customer who has filed the fewest complaints. | SELECT DISTINCT t1.product_name FROM products AS t1 JOIN complaints AS t2 ON t1.product_id = t2.product_id JOIN customers AS t3 GROUP BY t3.customer_id ORDER BY count(*) LIMIT 1 | Return the names of goods that have had complaints filed by the customer who has filed the fewest complaints. | customer_complaints |
What is the phone number of the customer who has filed the most recent complaint? | SELECT t1.phone_number FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.date_complaint_raised DESC LIMIT 1 | What is the telephone number of the client who has filed the most recent complaint? | customer_complaints |
Return the phone number of the customer who filed the complaint that was raised most recently. | SELECT t1.phone_number FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.date_complaint_raised DESC LIMIT 1 | Return the telephone number of the client who filed the complaint that was raised most recently. | customer_complaints |
Find the email and phone number of the customers who have never filed a complaint before. | SELECT email_address , phone_number FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM complaints) | Find the email and telephone number of the clients who have never filed a complaint before. | customer_complaints |
What are the emails and phone numbers of custoemrs who have never filed a complaint? | SELECT email_address , phone_number FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM complaints) | What are the emails and telephone numbers of clients who have never filed a complaint? | customer_complaints |
Find the phone number of all the customers and staff. | SELECT phone_number FROM customers UNION SELECT phone_number FROM staff | Find the telephone number of all the clients and staff. | customer_complaints |
What are the phone numbers of all customers and all staff members? | SELECT phone_number FROM customers UNION SELECT phone_number FROM staff | What are the telephone numbers of all clients and all staff members? | customer_complaints |
What is the description of the product named "Chocolate"? | SELECT product_description FROM products WHERE product_name = "Chocolate" | What is the describing content of the goods named "Chocolate"? | customer_complaints |
Return the description of the product called "Chocolate". | SELECT product_description FROM products WHERE product_name = "Chocolate" | Return the describing content of the goods called "Chocolate". | customer_complaints |
Find the name and category of the most expensive product. | SELECT product_name , product_category_code FROM products ORDER BY product_price DESC LIMIT 1 | Find the name and type of the most expensive goods. | customer_complaints |
What is the name and category code of the product with the highest price? | SELECT product_name , product_category_code FROM products ORDER BY product_price DESC LIMIT 1 | What is the name and type code of the goods with the highest price? | customer_complaints |
Find the prices of products which has never received a single complaint. | SELECT product_price FROM products WHERE product_id NOT IN (SELECT product_id FROM complaints) | Find the prices of goods which has never received a single complaint. | customer_complaints |
What are the prices of products that have never gotten a complaint? | SELECT product_price FROM products WHERE product_id NOT IN (SELECT product_id FROM complaints) | What are the prices of goods that have never gotten a complaint? | customer_complaints |
What is the average price of the products for each category? | SELECT avg(product_price) , product_category_code FROM products GROUP BY product_category_code | What is the average price of the goods for each type? | customer_complaints |
Return the average price of products that have each category code. | SELECT avg(product_price) , product_category_code FROM products GROUP BY product_category_code | Return the average price of goods that have each type code. | customer_complaints |
Find the last name of the staff member who processed the complaint of the cheapest product. | SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id JOIN products AS t3 ON t2.product_id = t3.product_id ORDER BY t3.product_price LIMIT 1 | Find the family name of the staff member who processed the complaint of the cheapest goods. | customer_complaints |
What is the last name of the staff member in charge of the complaint on the product with the lowest price? | SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id JOIN products AS t3 ON t2.product_id = t3.product_id ORDER BY t3.product_price LIMIT 1 | What is the family name of the staff member in charge of the complaint on the goods with the lowest price? | customer_complaints |
Which complaint status has more than 3 records on file? | SELECT complaint_status_code FROM complaints GROUP BY complaint_status_code HAVING count(*) > 3 | Which complain status has more than 3 records on file? | customer_complaints |
Return complaint status codes have more than 3 corresponding complaints? | SELECT complaint_status_code FROM complaints GROUP BY complaint_status_code HAVING count(*) > 3 | Return complain status codes have more than 3 corresponding complain? | customer_complaints |
Find the last name of the staff whose email address contains "wrau". | SELECT last_name FROM staff WHERE email_address LIKE "%wrau%" | Find the family name of the staff whose email address contains "wrau". | customer_complaints |
What are the last names of staff with email addressed containing the substring "wrau"? | SELECT last_name FROM staff WHERE email_address LIKE "%wrau%" | What are the family names of staff with email addressed containing the substring "wrau"? | customer_complaints |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.