jtjt520j/CSpider_for_Qwen huggingface dataset:
问题: 哪个国家有最多3个体育场馆在名单上？

SQL: SELECT country FROM stadium GROUP BY country HAVING count(*)  <=  3
问题: 哪个国家既有容量大于60000个的体育场馆，又有容量小于50000个的体育场？

SQL: SELECT country FROM stadium WHERE capacity  >  60000 INTERSECT SELECT country FROM stadium WHERE capacity  <  50000
问题: 有多少个城市有在2006年前开放的体育场？

SQL: SELECT count(DISTINCT city) FROM stadium WHERE opening_year  <  2006
问题: 每个国家有多少个体育场馆？

SQL: SELECT country ,  count(*) FROM stadium GROUP BY country
问题: 哪些国家没有在2006后开放的体育场？

SQL: SELECT country FROM stadium EXCEPT SELECT country FROM stadium WHERE opening_year  >  2006
问题: 在“俄罗斯”这个国家有多少个体育场？

SQL: SELECT count(*) FROM stadium WHERE country != '俄罗斯'
问题: 找出所有游泳运动员的名字，按他们的100米成绩按升序排列。

SQL: SELECT name FROM swimmer ORDER BY meter_100
问题: 游泳运动员来自多少个不同的国家？

SQL: SELECT count(DISTINCT nationality) FROM swimmer
问题: 列出有一个以上游泳运动员的国家。

SQL: SELECT nationality ,  count(*) FROM swimmer GROUP BY nationality HAVING count(*)  >  1
问题: 找出所有200米和300米游泳成绩且国籍是“澳大利亚”的游泳运动员。

SQL: SELECT meter_200 ,  meter_300 FROM swimmer WHERE nationality  =  '澳大利亚'
问题: 找出有结果是“胜利”的游泳运动员的名字。

SQL: SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id  =  t2.swimmer_id WHERE RESULT  =  '胜利'
问题: 举办最多赛事的体育场叫什么名字？

SQL: SELECT t1.name FROM stadium AS t1 JOIN event AS t2 ON t1.id  =  t2.stadium_id GROUP BY t2.stadium_id ORDER BY count(*) DESC LIMIT 1
问题: 找出“世界杯”活动发生的体育场的名称及其容量。

SQL: SELECT t1.name ,  t1.capacity FROM stadium AS t1 JOIN event AS t2 ON t1.id  =  t2.stadium_id WHERE t2.name  =  '世界杯'
问题: 找到那些从来没有举办过活动的体育场馆的名字。

SQL: SELECT name FROM stadium WHERE id NOT IN (SELECT stadium_id FROM event)
问题: 找出有最多数量记录的游泳者的名字。

SQL: SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id  =  t2.swimmer_id GROUP BY t2.swimmer_id ORDER BY count(*) DESC LIMIT 1
问题: 找到至少有2条记录的游泳运动员的名字。

SQL: SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id  =  t2.swimmer_id GROUP BY t2.swimmer_id HAVING count(*)  >=  2
问题: 找出“胜利”1次以上比赛的游泳运动员的姓名和国籍。

SQL: SELECT t1.name ,  t1.nationality FROM swimmer AS t1 JOIN record AS t2 ON t1.id  =  t2.swimmer_id WHERE RESULT  =  '胜利' GROUP BY t2.swimmer_id HAVING count(*)  >  1
问题: 找出没有记录的游泳运动员的名字。

SQL: SELECT name FROM swimmer WHERE id NOT IN (SELECT swimmer_id FROM record)
问题: 找出在记录中同时有“胜利”和“失败”结果的游泳运动员的名字。

SQL: SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id  =  t2.swimmer_id WHERE RESULT  =  '胜利' INTERSECT SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id  =  t2.swimmer_id WHERE RESULT  =  '输'
问题: 找出“澳大利亚”游泳运动员去过的体育场馆的名字。

SQL: SELECT t4.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id  =  t2.swimmer_id JOIN event AS t3 ON t2.event_id  =  t3.id JOIN stadium AS t4 ON t4.id  =  t3.stadium_id WHERE t1.nationality  =  '澳大利亚'
问题: 找出那些游泳运动员去过的体育场馆的名称。

SQL: SELECT t3.name FROM record AS t1 JOIN event AS t2 ON t1.event_id  =  t2.id JOIN stadium AS t3 ON t3.id  =  t2.stadium_id GROUP BY t2.stadium_id ORDER BY count(*) DESC LIMIT 1
问题: 找出每个游泳运动员的所有细节。

SQL: SELECT * FROM swimmer
问题: 2005年度开放的体育场的平均容量是多少？

SQL: SELECT avg(capacity) FROM stadium WHERE opening_year  =  2005
问题: 有多少条铁路？

SQL: SELECT count(*) FROM railway
问题: 按字母顺序升序排列列出铁路的建设者。

SQL: SELECT Builder FROM railway ORDER BY Builder ASC
问题: 列出铁路的轮子和位置。

SQL: SELECT Wheels ,  LOCATION FROM railway
问题: 那些国籍不是“澳大利亚”经理的最高水平是什么？

SQL: SELECT max(LEVEL) FROM manager WHERE Country != "澳大利亚"
问题: 所有经理的平均年龄是多少？

SQL: SELECT avg(Age) FROM manager
问题: 按等级升序排列经理的姓名是什么？

SQL: SELECT Name FROM manager ORDER BY LEVEL ASC
问题: 列车的名称和到达时间是多少？

SQL: SELECT Name ,  Arrival FROM train
问题: 最老的经理叫什么名字？

SQL: SELECT Name FROM manager ORDER BY Age DESC LIMIT 1
问题: 显示火车的名称和他们所在铁路的位置。

SQL: SELECT T2.Name ,  T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID  =  T2.Railway_ID
问题: 显示与“和谐号”列车相关的铁路建设商。

SQL: SELECT T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID  =  T2.Railway_ID WHERE T2.Name  =  "和谐号"
问题: 显示与超过一辆列车关联的铁路的ID和位置。

SQL: SELECT T2.Railway_ID ,  T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID  =  T2.Railway_ID GROUP BY T2.Railway_ID HAVING COUNT(*)  >  1
问题: 显示与做多数量列车相关的铁路的ID和建设者。

SQL: SELECT T2.Railway_ID ,  T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID  =  T2.Railway_ID GROUP BY T2.Railway_ID ORDER BY COUNT(*) DESC LIMIT 1
问题: 显示不同的铁路建设者，以及使用每个建设者建设的相应数量的铁路。

SQL: SELECT Builder ,  COUNT(*) FROM railway GROUP BY Builder
问题: 展示铁路最常见的建设者。

SQL: SELECT Builder FROM railway GROUP BY Builder ORDER BY COUNT(*) DESC LIMIT 1
问题: 显示不同位置的铁路以及每个位置的相应铁路的数量。

SQL: SELECT LOCATION ,  COUNT(*) FROM railway GROUP BY LOCATION
问题: 显示有超过一条铁路的位置。

SQL: SELECT LOCATION FROM railway GROUP BY LOCATION HAVING COUNT(*)  >  1
问题: 列出没有火车的铁路的目标数。

SQL: SELECT ObjectNumber FROM railway WHERE Railway_ID NOT IN (SELECT Railway_ID FROM train)
问题: 展示那些既有50岁以上经理又有46岁以下经理的国家。

SQL: SELECT Country FROM manager WHERE Age  >  50 INTERSECT SELECT Country FROM manager WHERE Age  <  46
问题: 展示管理者的不同国家。

SQL: SELECT DISTINCT Country FROM manager
问题: 按级别顺序递减显示经理的工作年限。

SQL: SELECT Working_year_starts FROM manager ORDER BY LEVEL DESC
问题: 显示年龄在50岁以上或46岁以下的管理人员所在的国家。

SQL: SELECT Country FROM manager WHERE Age  >  50 OR Age  <  46
问题: “中国”这个国家有多少个地址？

SQL: SELECT count(*) FROM addresses WHERE country  =  '中国'
问题: 显示在地址记录中的所有不同的城市。

SQL: SELECT DISTINCT city FROM addresses
问题: 显示每个省和每个省中的地址数量。

SQL: SELECT state_province_county ,  count(*) FROM addresses GROUP BY state_province_county
问题: 显示没有地址信息的客户的姓名和电话。

SQL: SELECT customer_name ,  customer_phone FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM customer_address_history)
问题: 显示订单量最多的客户的名字。

SQL: SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
问题: 显示具有至少两个产品的产品类型代码。

SQL: SELECT product_type_code FROM products GROUP BY product_type_code HAVING count(*)  >=  2
问题: 显示既具有“完成”状态的订单又具有“部分”状态的订单的客户的名字。

SQL: SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.order_status_code  =  '完成' INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.order_status_code  =  '部分'
问题: 按照客户编号的降序显示所有客户的名称、电话和支付方法代码。

SQL: SELECT customer_name ,  customer_phone ,  payment_method_code FROM customers ORDER BY customer_number DESC
问题: 显示每个产品的产品名称和总订单数量。

SQL: SELECT T1.product_name ,  sum(T2.order_quantity) FROM products AS T1 JOIN order_items AS T2 ON T1.product_id  =  T2.product_id GROUP BY T1.product_id
问题: 显示所有产品的最小，最大，平均价格。

SQL: SELECT min(product_price) ,  max(product_price) ,  avg(product_price) FROM products
问题: 有多少产品的价格高于平均水平？

SQL: SELECT count(*) FROM products WHERE product_price  >  (SELECT avg(product_price) FROM products)
问题: 显示每个客户地址历史的客户名称、客户地址城市、起始日期和送达日期。

SQL: SELECT T2.customer_name ,  T3.city ,  T1.date_from ,  T1.date_to FROM customer_address_history AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id JOIN addresses AS T3 ON T1.address_id  =  T3.address_id
问题: 显示使用“信用卡”付款方式并有2个以上订单的客户的姓名。

SQL: SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE T1.payment_method_code  =  '信用卡' GROUP BY T1.customer_id HAVING count(*)  >  2
问题: 订购数量最多的顾客的姓名和电话是什么？

SQL: SELECT  T1.customer_name ,  T1.customer_phone FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id JOIN order_items AS T3 ON T3.order_id  =  T2.order_id GROUP BY T1.customer_id ORDER BY sum(T3.order_quantity) DESC LIMIT 1
问题: 显示价格高于1000或低于500的产品类型和名称。

SQL: SELECT product_type_code ,  product_name FROM products WHERE product_price  >  1000 OR product_price  <  500
问题: 找出仅为女性使用的宿舍名称（“女性”性别）。

SQL: SELECT dorm_name FROM dorm WHERE gender  =  'F'
问题: 仅为“女性”使用的宿舍的名字是什么？

SQL: SELECT dorm_name FROM dorm WHERE gender  =  'F'
问题: 找出能容纳超过300名学生的宿舍名称。

SQL: SELECT dorm_name FROM dorm WHERE student_capacity  >  300
问题: 可以容纳超过300名学生住宿的宿舍名字是什么？

SQL: SELECT dorm_name FROM dorm WHERE student_capacity  >  300
问题: 年龄在25岁以下的女生有多少？（性别是“女性”）

SQL: SELECT count(*) FROM student WHERE sex  =  'F' AND age  <  25
问题: 25岁以下的“女”学生有多少？

SQL: SELECT count(*) FROM student WHERE sex  =  'F' AND age  <  25
问题: 找出20岁以上的学生的名字。

SQL: SELECT fname FROM student WHERE age  >  20
问题: 20岁以上的学生的名字是什么？

SQL: SELECT fname FROM student WHERE age  >  20
问题: 找出年龄在20到25岁之间且住在城市“天津”的学生的名字。

SQL: SELECT fname FROM student WHERE city_code  =  '天津' AND age BETWEEN 20 AND 25
问题: 住在"天津"市的20至25岁学生的名字是什么？

SQL: SELECT fname FROM student WHERE city_code  =  '天津' AND age BETWEEN 20 AND 25
问题: 有多少宿舍？

SQL: SELECT count(*) FROM dorm
问题: 数据库中有多少个宿舍？

SQL: SELECT count(*) FROM dorm
问题: 找出不同的宿舍设施的数量。

SQL: SELECT count(*) FROM dorm_amenity
问题: 有多少不同的宿舍设施？

SQL: SELECT count(*) FROM dorm_amenity
问题: 找到所有宿舍的总容量。

SQL: SELECT sum(student_capacity) FROM dorm
问题: 所有宿舍的学生总人数是多少？

SQL: SELECT sum(student_capacity) FROM dorm
问题: 有多少学生？

SQL: SELECT count(*) FROM student
问题: 找出每个城市学生的平均年龄。

SQL: SELECT avg(age) ,  city_code FROM student GROUP BY city_code
问题: 每个城市的平均年龄是什么？那些城市是什么？

SQL: SELECT avg(age) ,  city_code FROM student GROUP BY city_code
问题: 找出具有性别是“X”的学生宿舍的平均容量和总容量。

SQL: SELECT avg(student_capacity) ,  sum(student_capacity) FROM dorm WHERE gender  =  'X'
问题: 所有性别为“X”的宿舍的平均和总容量是多少？

SQL: SELECT avg(student_capacity) ,  sum(student_capacity) FROM dorm WHERE gender  =  'X'
问题: 找到一些有宿舍设施的宿舍。

SQL: SELECT count(DISTINCT dormid) FROM has_amenity
问题: 有多少宿舍有设施？

SQL: SELECT count(DISTINCT dormid) FROM has_amenity
问题: 找到没有设施的宿舍的名字

SQL: SELECT dorm_name FROM dorm WHERE dormid NOT IN (SELECT dormid FROM has_amenity)
问题: 所有没有设施的宿舍的名字是什么？

SQL: SELECT dorm_name FROM dorm WHERE dormid NOT IN (SELECT dormid FROM has_amenity)
问题: 找出宿舍的不同性别的数量。

SQL: SELECT count(DISTINCT gender) FROM dorm
问题: 宿舍里有多少不同性别的人？

SQL: SELECT count(DISTINCT gender) FROM dorm
问题: 找出名字中包含“慧”字的宿舍中学生的能力和性别.

SQL: SELECT student_capacity ,  gender FROM dorm WHERE dorm_name LIKE '慧'
问题: 名字中包含“慧”字段的宿舍中学生的能力和性别是什么？

SQL: SELECT student_capacity ,  gender FROM dorm WHERE dorm_name LIKE '慧'
问题: 找出容量大于300或小于100的宿舍的名称和性别类型。

SQL: SELECT dorm_name ,  gender FROM dorm WHERE student_capacity  >  300 OR student_capacity  <  100
问题: 容量大于300或小于100的宿舍的名称和类型是什么？

SQL: SELECT dorm_name ,  gender FROM dorm WHERE student_capacity  >  300 OR student_capacity  <  100
问题: 找到不同专业和城市的数量。

SQL: SELECT count(DISTINCT major) ,  count(DISTINCT city_code) FROM student
问题: 有多少不同的专业，每个学生有多少不同的城市编号？

SQL: SELECT count(DISTINCT major) ,  count(DISTINCT city_code) FROM student
问题: 找到既有“客厅”又有“自习室”作为设施的宿舍的名称。

SQL: 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  =  '客厅' 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  =  '自习室'
问题: 既有“客厅”又有“自习室”的宿舍叫什么名字？

SQL: 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  =  '客厅' 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  =  '自习室'
问题: 找出有“客厅”但没有“自习室”作为设施的宿舍的名字。

SQL: 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  =  '客厅' 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  =  '自习室'
问题: 有“客厅”但没有“自习室”的每间宿舍叫什么名字？

SQL: 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  =  '客厅' 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  =  '自习室'
问题: 找出那些生活在代号为“武汉”的女性（性别是“女性”）或者年龄在20岁以下的男性（性别是“男”）学生的姓氏。

SQL: SELECT lname FROM student WHERE sex  =  'F' AND city_code  =  '武汉' UNION SELECT lname FROM student WHERE sex  =  '男' AND age  <  20
问题: 那些生活在代号为“武汉”的女性（性别是“女性”）或者年龄在20岁以下的男性（性别是“男”）学生的姓氏是什么？

SQL: SELECT lname FROM student WHERE sex  =  'F' AND city_code  =  '武汉' UNION SELECT lname FROM student WHERE sex  =  '男' AND age  <  20
问题: 找到容量最大的宿舍的名字。

SQL: SELECT dorm_name FROM dorm ORDER BY student_capacity DESC LIMIT 1
问题: 容量最大的宿舍是什么名字？

SQL: SELECT dorm_name FROM dorm ORDER BY student_capacity DESC LIMIT 1
问题: 按字母顺序列出所有不同的宿舍设施。

SQL: SELECT amenity_name FROM dorm_amenity ORDER BY amenity_name
问题: 不同的宿舍设施名称按字母顺序排列是什么？

SQL: SELECT amenity_name FROM dorm_amenity ORDER BY amenity_name
问题: 找出大多数学生居住的城市代码。

SQL: SELECT city_code FROM student GROUP BY city_code ORDER BY count(*) DESC LIMIT 1
问题: 最多数量的学生居住的城市代码是什么？

SQL: SELECT city_code FROM student GROUP BY city_code ORDER BY count(*) DESC LIMIT 1
问题: 找出年龄小于平均年龄的学生的名字和姓氏。

SQL: SELECT fname ,  lname FROM student WHERE age  <  (SELECT avg(age) FROM student)
问题: 所有年龄小于平均水平的学生的名字和姓氏是什么？

SQL: SELECT fname ,  lname FROM student WHERE age  <  (SELECT avg(age) FROM student)
问题: 根据编码“香港”列出不在该城市居住的学生的名字和姓氏，并按年龄对结果进行排序。

SQL: SELECT fname ,  lname FROM student WHERE city_code != '香港' ORDER BY age
问题: 按年龄排序的所有未在“香港”生活的学生的姓氏和名字是什么？

SQL: SELECT fname ,  lname FROM student WHERE city_code != '香港' ORDER BY age
问题: 按字母顺序对结果进行排序列出“礼堂”的所有设施的名称。

SQL: 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  =  '礼堂' ORDER BY T1.amenity_name
问题: 按字母顺序列出的“礼堂”的所有设施有哪些？

SQL: 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  =  '礼堂' ORDER BY T1.amenity_name
问题: 找出宿舍的数量和每个性别的总容量。

SQL: SELECT count(*) ,  sum(student_capacity) ,  gender FROM dorm GROUP BY gender
问题: 有多少个宿舍且每个性别的总容量是多少？

SQL: SELECT count(*) ,  sum(student_capacity) ,  gender FROM dorm GROUP BY gender
问题: 找出不同性别学生的平均年龄和最高年龄。

SQL: SELECT avg(age) ,  max(age) ,  sex FROM student GROUP BY sex
问题: 每个性别的平均年龄和最高龄是多少？

SQL: SELECT avg(age) ,  max(age) ,  sex FROM student GROUP BY sex
问题: 找出每个专业学生的人数。

SQL: SELECT count(*) ,  major FROM student GROUP BY major
问题: 每个专业有多少学生？

SQL: SELECT count(*) ,  major FROM student GROUP BY major
问题: 找到居住在每个城市的学生的数量和平均年龄。

SQL: SELECT count(*) ,  avg(age) ,  city_code FROM student GROUP BY city_code
问题: 每个城市有多少学生且对应的平均年龄是多少？

SQL: SELECT count(*) ,  avg(age) ,  city_code FROM student GROUP BY city_code
问题: 找出每个城市男生（性别是“男”）的平均年龄和数量。

SQL: SELECT count(*) ,  avg(age) ,  city_code FROM student WHERE sex  =  '男' GROUP BY city_code
问题: 每个城市的平均年龄和男学生有多少？

SQL: SELECT count(*) ,  avg(age) ,  city_code FROM student WHERE sex  =  '男' GROUP BY city_code
问题: 找到拥有一个以上学生的城市其对应的学生人数。

SQL: SELECT count(*) ,  city_code FROM student GROUP BY city_code HAVING count(*)  >  1
问题: 每个城市有多少学生，哪个城市有不止一个城市？

SQL: SELECT count(*) ,  city_code FROM student GROUP BY city_code HAVING count(*)  >  1
问题: 查找不属于最大专业的学生的姓氏和姓氏。

SQL: SELECT fname ,  lname FROM student WHERE major != (SELECT major FROM student GROUP BY major ORDER BY count(*) DESC LIMIT 1)
问题: 不是最大的专业的学生的名字和姓氏是什么？

SQL: SELECT fname ,  lname FROM student WHERE major != (SELECT major FROM student GROUP BY major ORDER BY count(*) DESC LIMIT 1)
问题: 找出每个性别中年龄大于平均年龄的学生人数。

SQL: SELECT count(*) ,  sex FROM student WHERE age  >  (SELECT avg(age) FROM student) GROUP BY sex
问题: 每个性别中大于平均年龄的学生人数有多少？

SQL: SELECT count(*) ,  sex FROM student WHERE age  >  (SELECT avg(age) FROM student) GROUP BY sex
问题: 找到每个宿舍学生的平均年龄和宿舍名称。

SQL: 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
问题: 每个宿舍的平均年龄是多少，每个宿舍的名字是什么？

SQL: 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
问题: 找出每个可以容纳100多名学生的宿舍的设施数量。

SQL: 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
问题: 每个宿舍都有多少设施？

SQL: 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
问题: 找到每个宿舍里年龄大于20岁的学生。

SQL: 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
问题: 每个宿舍有多少学生年龄大于20岁？

SQL: 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
问题: 找到住在“大礼堂”的学生的名字。

SQL: 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  =  '大礼堂'
问题: “大礼堂”所有学生的名字是什么？

SQL: 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  =  '大礼堂'
问题: 找出住容量最大的宿舍的学生的平均年龄。

SQL: 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)
问题: 住在容量最大的宿舍的学生的平均年龄是多少？

SQL: 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)
问题: 找出住在男生宿舍的学生总数（性别是“男”）。

SQL: 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  =  '男'
问题: 住在“男”宿舍里的学生总数是多少？

SQL: 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  =  '男'
问题: 找出居住在“大礼堂”的女学生（性别是“F”）

SQL: 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  =  '大礼堂' AND T1.sex  =  'F'
问题: “大礼堂”有多少“女”学生居住？

SQL: 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  =  '大礼堂' AND T1.sex  =  'F'
问题: 找出“大礼堂”宿舍设施的名称。

SQL: 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  =  '大礼堂'
问题: “大礼堂”的设施名称是什么？

SQL: 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  =  '大礼堂'
问题: 找出“大礼堂”宿舍的名称。根据设施名称对结果进行排序。

SQL: 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  =  '大礼堂' ORDER BY T3.amenity_name
问题: “大礼堂”按字母顺序有哪些设施？

SQL: 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  =  '大礼堂' ORDER BY T3.amenity_name
问题: 找出所有宿舍中最常见的设施的名字。

SQL: 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
问题: 宿舍里最常见的设施是什么？

SQL: 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
问题: 找到住在设施最多的宿舍的学生的名字。

SQL: 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)
问题: 住在设施最多的宿舍的所有学生的名字是什么？

SQL: 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)
问题: 找出设施最少的宿舍的名称和容量。

SQL: 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
问题: 有最少设施的宿舍的名称和容量是什么？

SQL: 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
问题: 找到没有“客厅”设施的宿舍的名字。

SQL: 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  =  '客厅'
问题: 没有“客厅”设施的宿舍的名字是什么？

SQL: 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  =  '客厅'
问题: 找出住在有“客厅”设施的宿舍的学生的名字和姓氏。

SQL: 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  =  '客厅')
问题: 住在拥有“客厅”设施的宿舍里的所有学生的名字和姓氏是什么？

SQL: 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  =  '客厅')
问题: 找到住在没有“客厅”设施的宿舍的学生的名字和年龄。

SQL: 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  =  '客厅')
问题: 每个住在“客厅”设施的宿舍的学生的名字和年龄是多少？

SQL: 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  =  '客厅')
问题: 找到姓“帅”的学生住的宿舍的设施的名称。

SQL: 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  =  '帅'
问题: 姓氏为“帅”的学生住在宿舍里有什么设施？

SQL: 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  =  '帅'
问题: 那里有多少顾客？

SQL: SELECT count(*) FROM customers
问题: 统计客户的数量。

SQL: SELECT count(*) FROM customers
问题: 根据电子邮件地址和电话号码排序查找所有客户的电子邮件和电话号码。

SQL: SELECT email_address ,  phone_number FROM customers ORDER BY email_address ,  phone_number
问题: 按电子邮件地址和电话号码排序的所有客户的电子邮件和电话号码是什么？

SQL: SELECT email_address ,  phone_number FROM customers ORDER BY email_address ,  phone_number
问题: 哪个城市的类型代码是“良好信用评级”的客户数量最少？

SQL: SELECT town_city FROM customers WHERE customer_type_code  =  "良好信用评级" GROUP BY town_city ORDER BY count(*) LIMIT 1
问题: 返回有最少客户的客户类型代码为“良好信用评级”的城市。

SQL: SELECT town_city FROM customers WHERE customer_type_code  =  "良好信用评级" GROUP BY town_city ORDER BY count(*) LIMIT 1
问题: 列出所有产品的名称以及其收到的投诉数量。

SQL: 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
问题: 所有不同的产品名称是什么 ，以及每个收到多少投诉？

SQL: 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
问题: 找出那些对产品投诉最多的那个客户的电子邮件。

SQL: 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
问题: 对产品投诉最多的客户的电子邮件是什么？

SQL: 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
问题: 哪些产品被最少的客户投诉？

SQL: 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