output
stringlengths 18
577
| instruction
stringlengths 16
224
| input
stringclasses 160
values |
---|---|---|
SELECT count(DISTINCT major) , count(DISTINCT city_code) FROM student | Find the numbers of different majors and cities. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT count(DISTINCT major) , count(DISTINCT city_code) FROM student | How many different majors are there and how many different city codes are there for each student? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorms which have both TV Lounge and Study Room as amenities. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorm with both a TV Lounge and Study Room listed as amenities? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorms which have TV Lounge but no Study Room as amenity. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorm that has a TV Lounge but no study rooms? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT lname FROM student WHERE sex = 'F' AND city_code = 'BAL' UNION SELECT lname FROM student WHERE sex = 'M' AND age < 20 | 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. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 last name of every student who is either female or living in a city with the code BAL or male and under 20? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT dorm_name FROM dorm ORDER BY student_capacity DESC LIMIT 1 | Find the name of the dorm with the largest capacity. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT dorm_name FROM dorm ORDER BY student_capacity DESC LIMIT 1 | What are the names of the dorm with the largest capacity? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT amenity_name FROM dorm_amenity ORDER BY amenity_name | List in alphabetic order all different amenities. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT amenity_name FROM dorm_amenity ORDER BY amenity_name | What are the different dorm amenity names in alphabetical order? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT fname , lname FROM student WHERE age < (SELECT avg(age) FROM student) | Find the first and last name of students whose age is younger than the average age. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT fname , lname FROM student WHERE age < (SELECT avg(age) FROM student) | What is the first and last name of all students who are younger than average? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT fname , lname FROM student WHERE city_code != 'HKG' ORDER BY age | 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. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT fname , lname FROM student WHERE city_code != 'HKG' ORDER BY age | What are the first and last names of all students who are not living in the city HKG and order the results by age? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT count(*) , sum(student_capacity) , gender FROM dorm GROUP BY gender | Find the number of dorms and total capacity for each gender. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT count(*) , sum(student_capacity) , gender FROM dorm GROUP BY gender | How many dorms are there and what is the total capacity for each gender? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT avg(age) , max(age) , sex FROM student GROUP BY sex | Find the average and oldest age for students with different sex. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT avg(age) , max(age) , sex FROM student GROUP BY sex | What is the average and oldest age for each gender of student? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT count(*) , major FROM student GROUP BY major | Find the number of students in each major. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT count(*) , major FROM student GROUP BY major | How many students are there in each major? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT count(*) , avg(age) , city_code FROM student GROUP BY city_code | Find the number and average age of students living in each city. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT fname , lname FROM student WHERE major != (SELECT major FROM student GROUP BY major ORDER BY count(*) DESC LIMIT 1) | Find the first and last name of students who are not in the largest major. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT fname , lname FROM student WHERE major != (SELECT major FROM student GROUP BY major ORDER BY count(*) DESC LIMIT 1) | What is the first and last name of the students who are not in the largest major? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorm and the name of dorm. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorm and what are the names of each dorm? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorms that can accommodate more than 100 students. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorm, how many amenities does it have? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorm. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorm? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 first name of students who are living in the Smith Hall. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 first names of all students in Smith Hall? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorm with the largest capacity. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorm with the largest capacity? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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). | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorms. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorms? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 first name of students who are living in the dorm that has most number of amenities. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 first names of all students who live in the dorm with the most amenities? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorm with least number of amenities. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorm with the fewest amount of amenities? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorms that do not have amenity TV Lounge. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorm that does not have a TV Lounge? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 first and last name of students who are living in the dorms that have amenity TV Lounge. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 first and last names of all students who are living in a dorm with a TV Lounge? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 first name and age of students who are living in the dorms that do not have amenity TV Lounge. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 first name and age of every student who lives in a dorm with a TV Lounge? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorm where the student with last name Smith is living in. | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
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 dorm that a student who has the last name of Smith lives in? | "Schema (values (type))": Student : StuID (number) , LName (text) , Fname (text) , Age (number) , Sex (text) , Major (number) , Advisor (number) , city_code (text) | Dorm : dormid (number) , dorm_name (text) , student_capacity (number) , gender (text) | Dorm_amenity : amenid (number) , amenity_name (text) | Has_amenity : dormid (number) , amenid (number) | Lives_in : stuid (number) , dormid (number) , room_number (number)
"Primary Keys": Student : StuID
"Foreign Keys": Has_amenity : amenid equals Dorm_amenity : amenid | Has_amenity : dormid equals Dorm : dormid | Lives_in : dormid equals Dorm : dormid | Lives_in : stuid equals Student : StuID |
SELECT count(*) FROM customers | How many customers are there? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT count(*) FROM customers | Count the number of customers. | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT email_address , phone_number FROM customers ORDER BY email_address , phone_number | Find the emails and phone numbers of all the customers, ordered by email address and phone number. | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT email_address , phone_number FROM customers ORDER BY email_address , phone_number | What are the emails and phone numbers of all customers, sorted by email address and phone number? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
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 customers whose type code is "Good Credit Rating"? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
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 customer type code "Good Credit Rating" that had the fewest customers. | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
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 products along with the number of complaints that they have received. | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
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 product names, and how many complains has each received? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
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 customers who has filed a complaints of the product with the most complaints. | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
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 customers who have filed complaints on the product which has had the greatest number of complaints? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
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 products has been complained by the customer who has filed least amount of complaints? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
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 products that have had complaints filed by the customer who has filed the fewest complaints. | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
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 phone number of the customer who has filed the most recent complaint? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
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 phone number of the customer who filed the complaint that was raised most recently. | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT email_address , phone_number FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM complaints) | Find the email and phone number of the customers who have never filed a complaint before. | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT email_address , phone_number FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM complaints) | What are the emails and phone numbers of custoemrs who have never filed a complaint? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT phone_number FROM customers UNION SELECT phone_number FROM staff | Find the phone number of all the customers and staff. | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT phone_number FROM customers UNION SELECT phone_number FROM staff | What are the phone numbers of all customers and all staff members? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT product_description FROM products WHERE product_name = "Chocolate" | What is the description of the product named "Chocolate"? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT product_description FROM products WHERE product_name = "Chocolate" | Return the description of the product called "Chocolate". | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT product_name , product_category_code FROM products ORDER BY product_price DESC LIMIT 1 | Find the name and category of the most expensive product. | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT product_name , product_category_code FROM products ORDER BY product_price DESC LIMIT 1 | What is the name and category code of the product with the highest price? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT product_price FROM products WHERE product_id NOT IN (SELECT product_id FROM complaints) | Find the prices of products which has never received a single complaint. | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT product_price FROM products WHERE product_id NOT IN (SELECT product_id FROM complaints) | What are the prices of products that have never gotten a complaint? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT avg(product_price) , product_category_code FROM products GROUP BY product_category_code | What is the average price of the products for each category? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT avg(product_price) , product_category_code FROM products GROUP BY product_category_code | Return the average price of products that have each category code. | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
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 last name of the staff member who processed the complaint of the cheapest product. | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
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 last name of the staff member in charge of the complaint on the product with the lowest price? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT complaint_status_code FROM complaints GROUP BY complaint_status_code HAVING count(*) > 3 | Which complaint status has more than 3 records on file? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT complaint_status_code FROM complaints GROUP BY complaint_status_code HAVING count(*) > 3 | Return complaint status codes have more than 3 corresponding complaints? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT last_name FROM staff WHERE email_address LIKE "%wrau%" | Find the last name of the staff whose email address contains "wrau". | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
SELECT last_name FROM staff WHERE email_address LIKE "%wrau%" | What are the last names of staff with email addressed containing the substring "wrau"? | "Schema (values (type))": Staff : staff_id (number) , gender (text) , first_name (text) , last_name (text) , email_address (text) , phone_number (text) | Customers : customer_id (number) , customer_type_code (text) , address_line_1 (text) , address_line_2 (text) , town_city (text) , state (text) , email_address (text) , phone_number (text) | Products : product_id (number) , parent_product_id (number) , product_category_code (text) , date_product_first_available (time) , date_product_discontinued (time) , product_name (text) , product_description (text) , product_price (number) | Complaints : complaint_id (number) , product_id (number) , customer_id (number) , complaint_outcome_code (text) , complaint_status_code (text) , complaint_type_code (text) , date_complaint_raised (time) , date_complaint_closed (time) , staff_id (number)
"Primary Keys": Staff : staff_id | Customers : customer_id | Products : product_id
"Foreign Keys": Complaints : customer_id equals Customers : customer_id | Complaints : product_id equals Products : product_id | Complaints : staff_id equals Staff : staff_id |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.