jtjt520j/CSpider_for_Qwen huggingface dataset:
问题: 列出未被提名的作品名称。

SQL: SELECT Name FROM Artwork WHERE Artwork_ID NOT IN (SELECT Artwork_ID FROM nomination)
问题: 显示2008或2010年的观众数量。

SQL: SELECT Num_of_Audience FROM festival_detail WHERE YEAR  =  2008 OR YEAR  =  2010
问题: 参观这些艺术节的观众总数是多少？

SQL: SELECT sum(Num_of_Audience) FROM festival_detail
问题: 哪一年“美国”国内和“美国”国外都有艺术节？

SQL: SELECT YEAR FROM festival_detail WHERE LOCATION  =  '美国' INTERSECT SELECT YEAR FROM festival_detail WHERE LOCATION != '美国'
问题: 有多少处建筑物？

SQL: SELECT count(*) FROM premises
问题: 什么是不同的建筑物的类型？

SQL: SELECT DISTINCT premises_type FROM premises
问题: 通过建筑物类型查找所有房屋和订单的类型和细节。

SQL: SELECT premises_type ,  premise_details FROM premises ORDER BY premises_type
问题: 显示每个建筑物类型和该类型的建筑物数。

SQL: SELECT premises_type ,  count(*) FROM premises GROUP BY premises_type
问题: 显示所有不同的产品类别以及每个类别中的邮件的数量。

SQL: SELECT product_category ,  count(*) FROM mailshot_campaigns GROUP BY product_category
问题: 在没有任何邮件的情况下显示客户的姓名和电话。

SQL: SELECT customer_name ,  customer_phone FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM mailshot_customers)
问题: 显示用带有“无回应”结果代码的发放邮件客户的姓名和电话。

SQL: SELECT T1.customer_name ,  T1.customer_phone FROM customers AS T1 JOIN mailshot_customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.outcome_code  =  '无回应'
问题: 显示邮件快照的结果代码以及每个结果代码中的邮件快照数量。

SQL: SELECT outcome_code ,  count(*) FROM mailshot_customers GROUP BY outcome_code
问题: 显示至少有2个邮件的客户且结果代码是“预定”的客户姓名。

SQL: SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE outcome_code  =  '预定' GROUP BY T1.customer_id HAVING count(*)  >=  2
问题: 显示邮件最多的客户的名字。

SQL: SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
问题: 在邮件结果中同时具有“预定”邮件快照和具有“无回应”邮件快照的客户的姓名和支付方法是什么？

SQL: SELECT T2.customer_name ,  T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T1.outcome_code  =  '预定' INTERSECT SELECT T2.customer_name ,  T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T1.outcome_code  =  '无回应'
问题: 针对所有客户地址显示建筑物类型和地址类型代码。

SQL: SELECT T2.premises_type ,  T1.address_type_code FROM customer_addresses AS T1 JOIN premises AS T2 ON T1.premise_id  =  T2.premise_id
问题: 对于所有的客户地址，有什么不同的地址类型代码？

SQL: SELECT DISTINCT address_type_code FROM customer_addresses
问题: 显示“取消”或“付款”订单状态的客户订单的装运费和客户ID。

SQL: SELECT order_shipping_charges ,  customer_id FROM customer_orders WHERE order_status_code  =  '取消' OR order_status_code  =  '付款'
问题: 显示具有配送方法是“顺丰快递”和订单状态“付款”的订单客户的名称。

SQL: SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE shipping_method_code  =  '顺丰快递' AND order_status_code  =  '付款'
问题: 一共有多少门课？

SQL: SELECT count(*) FROM COURSE
问题: 统计课程的数量。

SQL: SELECT count(*) FROM COURSE
问题: 有多少课程有超过2学分？

SQL: SELECT count(*) FROM COURSE WHERE Credits  >  2
问题: 统计超过2学分的课程数。

SQL: SELECT count(*) FROM COURSE WHERE Credits  >  2
问题: 列出1学分的课程名称。

SQL: SELECT CName FROM COURSE WHERE Credits  =  1
问题: 1学分的课程名称是什么？

SQL: SELECT CName FROM COURSE WHERE Credits  =  1
问题: 哪些课程是在“星期一”那一天教授的？

SQL: SELECT CName FROM COURSE WHERE Days  =  "星期一"
问题: 在“星期一”那一天教授的课程名称是什么？

SQL: SELECT CName FROM COURSE WHERE Days  =  "星期一"
问题: 在分公司“管理部”的部门数量是多少？

SQL: SELECT count(*) FROM DEPARTMENT WHERE Division  =  "管理部"
问题: 在分公司“管理部”有多少个部门？

SQL: SELECT count(*) FROM DEPARTMENT WHERE Division  =  "管理部"
问题: 268号房的电话是什么？

SQL: SELECT DPhone FROM DEPARTMENT WHERE Room  =  268
问题: 给位置在268号房间内的部门打电话。

SQL: SELECT DPhone FROM DEPARTMENT WHERE Room  =  268
问题: 找到至少有一个成绩为“B”的学生人数。

SQL: SELECT COUNT(DISTINCT StuID) FROM ENROLLED_IN WHERE Grade  =  "B"
问题: 有多少学生至少有一门成绩是“B”级？

SQL: SELECT COUNT(DISTINCT StuID) FROM ENROLLED_IN WHERE Grade  =  "B"
问题: 在所有字母分数中找出所有字母等级的最大和最小等级点。

SQL: SELECT max(gradepoint) ,  min(gradepoint) FROM GRADECONVERSION
问题: 分数的最大值和最小值是多少？

SQL: SELECT max(gradepoint) ,  min(gradepoint) FROM GRADECONVERSION
问题: 找出名字包含“安”字的学生的名字。

SQL: SELECT DISTINCT Fname FROM STUDENT WHERE Fname LIKE 'a'
问题: 名字中包含“安”的学生的名字是什么？

SQL: SELECT DISTINCT Fname FROM STUDENT WHERE Fname LIKE 'a'
问题: 查找住在“行政”大楼的男性（性别是“男”）教职员工的名字和姓氏。

SQL: SELECT Fname ,  Lname FROM FACULTY WHERE sex  =  "男" AND Building  =  "行政"
问题: 住在“行政”大楼的男性（性别是“男”）教职员工的名字和姓氏是什么？

SQL: SELECT Fname ,  Lname FROM FACULTY WHERE sex  =  "男" AND Building  =  "行政"
问题: 找到居住在“行政”大楼的高级教授的房间。

SQL: SELECT Room FROM FACULTY WHERE Rank  =  "教授" AND Building  =  "行政"
问题: 居住在“行政”大楼的高级教授的房间是什么？

SQL: SELECT Room FROM FACULTY WHERE Rank  =  "教授" AND Building  =  "行政"
问题: 找到位置在“逸夫”大楼的部门的名称。

SQL: SELECT DName FROM DEPARTMENT WHERE Building  =  "逸夫"
问题: 在“逸夫”大楼内的部门名称是什么？

SQL: SELECT DName FROM DEPARTMENT WHERE Building  =  "逸夫"
问题: 列出以学分升序排列的所有课程信息。

SQL: SELECT * FROM COURSE ORDER BY Credits
问题: 以学分升序排列的所有课程信息是什么？

SQL: SELECT * FROM COURSE ORDER BY Credits
问题: 按学分排序列出的课程名称。

SQL: SELECT CName FROM COURSE ORDER BY Credits
问题: 按学分排序的课程名称是什么？

SQL: SELECT CName FROM COURSE ORDER BY Credits
问题: 按年龄递减顺序查找学生的名字。

SQL: SELECT Fname FROM STUDENT ORDER BY Age DESC
问题: 按年龄顺序从最大到最小排列的学生的名字是什么？

SQL: SELECT Fname FROM STUDENT ORDER BY Age DESC
问题: 按年龄递减顺序查找女性学生的姓氏（性别为“女性”）。

SQL: SELECT LName FROM STUDENT WHERE Sex  =  "F" ORDER BY Age DESC
问题: 按年龄降序顺序排序的“女性”学生的姓氏是什么？

SQL: SELECT LName FROM STUDENT WHERE Sex  =  "F" ORDER BY Age DESC
问题: 根据字母顺序找出在“行政楼”建筑中机构工作的工作人员的姓氏。

SQL: SELECT Lname FROM FACULTY WHERE Building  =  "行政楼" ORDER BY Lname
问题: 根据字母顺序的在“行政楼”建筑中机构工作的工作人员的姓氏是什么？

SQL: SELECT Lname FROM FACULTY WHERE Building  =  "行政楼" ORDER BY Lname
问题: 按字母顺序查找职级是“教授”的职工的名字。

SQL: SELECT Fname FROM FACULTY WHERE Rank  =  "教授" ORDER BY Fname
问题: 按字母顺序排列的职级是“教授”的职工的名字是什么？

SQL: SELECT Fname FROM FACULTY WHERE Rank  =  "教授" ORDER BY Fname
问题: 找到辅修人数最多的系的名字？

SQL: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO  =  T2.DNO GROUP BY T2.DNO ORDER BY count(*) DESC LIMIT 1
问题: 有辅修学生最多的专业叫什么名字？

SQL: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO  =  T2.DNO GROUP BY T2.DNO ORDER BY count(*) DESC LIMIT 1
问题: 找到没有学生参与辅修的专业的名字。

SQL: SELECT DName FROM DEPARTMENT EXCEPT SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO  =  T2.DNO
问题: 没有学生参与辅修的专业的名字 是什么？

SQL: SELECT DName FROM DEPARTMENT EXCEPT SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO  =  T2.DNO
问题: 找出拥有最少会员人数的部门的名称。

SQL: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO  =  T2.DNO GROUP BY T2.DNO ORDER BY count(*) ASC LIMIT 1
问题: 拥有最少会员人数的部门名称是什么？

SQL: SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO  =  T2.DNO GROUP BY T2.DNO ORDER BY count(*) ASC LIMIT 1
问题: 找出教职人员最少的教职人员的职级。

SQL: SELECT Rank FROM FACULTY GROUP BY Rank ORDER BY count(*) ASC LIMIT 1
问题: 什么是最不常见的教职员工职级？

SQL: SELECT Rank FROM FACULTY GROUP BY Rank ORDER BY count(*) ASC LIMIT 1
问题: 教授课程数前三多的老师的名字和姓氏是什么？

SQL: SELECT T2.Fname ,  T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor  =  T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 3
问题: 教授课程数最多的3名老师的名字和姓氏是什么？

SQL: SELECT T2.Fname ,  T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor  =  T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 3
问题: 教课最多的老师住在哪栋楼里？

SQL: SELECT T2.Building FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor  =  T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 1
问题: 给出教授课程数最多的老师住的大楼。

SQL: SELECT T2.Building FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor  =  T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 1
问题: 至少有五人参加的课程名称是什么？

SQL: SELECT T1.CName FROM COURSE AS T1 JOIN ENROLLED_IN AS T2 ON T1.CID  =  T2.CID GROUP BY T2.CID HAVING COUNT(*)  >=  5
问题: 列出至少有五人的课程的名称。

SQL: SELECT T1.CName FROM COURSE AS T1 JOIN ENROLLED_IN AS T2 ON T1.CID  =  T2.CID GROUP BY T2.CID HAVING COUNT(*)  >=  5
问题: 找出具有课程名称为“计算机基础”的教师的名字和姓氏

SQL: SELECT T2.Fname ,  T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor  =  T2.FacID WHERE T1.CName  =  "计算机基础"
问题: 有“计算机基础”课程的老师的全名是什么？

SQL: SELECT T2.Fname ,  T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor  =  T2.FacID WHERE T1.CName  =  "计算机基础"
问题: 查找教授“计算机导论”的部门名称和房间。

SQL: SELECT T2.Dname ,  T2.Room FROM COURSE AS T1 JOIN DEPARTMENT AS T2 ON T1.DNO  =  T2.DNO WHERE T1.CName  =  "计算机导论"
问题: “计算机导论”这门课的系名和课室是什么？

SQL: SELECT T2.Dname ,  T2.Room FROM COURSE AS T1 JOIN DEPARTMENT AS T2 ON T1.DNO  =  T2.DNO WHERE T1.CName  =  "计算机导论"
问题: 找到所有注册学生的名字、姓氏和分数。

SQL: SELECT T3.Fname ,  T3.LName ,  T2.gradepoint FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade  =  T2.lettergrade AND T1.StuID  =  T3.StuID
问题: 所有注册学生的全名和分数是什么？

SQL: SELECT T3.Fname ,  T3.LName ,  T2.gradepoint FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade  =  T2.lettergrade AND T1.StuID  =  T3.StuID
问题: 找出一门课程的分数至少是3.8的所有学生的不同名字。

SQL: SELECT DISTINCT T3.Fname FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade  =  T2.lettergrade AND T1.StuID  =  T3.StuID WHERE T2.gradepoint  >=  3.8
问题: 在至少一门课程中，成绩在3.8或以上的学生的名字是什么？

SQL: SELECT DISTINCT T3.Fname FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade  =  T2.lettergrade AND T1.StuID  =  T3.StuID WHERE T2.gradepoint  >=  3.8
问题: 查找系号为520的系人员中教员的全名。

SQL: SELECT T1.Fname ,  T1.Lname FROM FACULTY AS T1 JOIN MEMBER_OF AS T2 ON T1.FacID  =  T2.FacID WHERE T2.DNO  =  520
问题: 系号为520的系人员中教员的全名是什么？

SQL: SELECT T1.Fname ,  T1.Lname FROM FACULTY AS T1 JOIN MEMBER_OF AS T2 ON T1.FacID  =  T2.FacID WHERE T2.DNO  =  520
问题: 在DNO 140系辅修的学生的名字和姓氏是什么？

SQL: SELECT T2.Fname ,  T2.Lname FROM MINOR_IN AS T1 JOIN STUDENT AS T2 ON T1.StuID  =  T2.StuID WHERE T1.DNO  =  140
问题: 参与140系辅修课程的学生的全名是什么？

SQL: SELECT T2.Fname ,  T2.Lname FROM MINOR_IN AS T1 JOIN STUDENT AS T2 ON T1.StuID  =  T2.StuID WHERE T1.DNO  =  140
问题: 查找“计算机科学”系成员的姓氏。

SQL: SELECT T2.Lname FROM DEPARTMENT AS T1 JOIN FACULTY AS T2 ON T1.DNO  =  T3.DNO JOIN MEMBER_OF AS T3 ON T2.FacID  =  T3.FacID WHERE T1.DName  =  "计算机科学"
问题: “计算机科学”系教员的姓氏是什么？

SQL: SELECT T2.Lname FROM DEPARTMENT AS T1 JOIN FACULTY AS T2 ON T1.DNO  =  T3.DNO JOIN MEMBER_OF AS T3 ON T2.FacID  =  T3.FacID WHERE T1.DName  =  "计算机科学"
问题: 找出姓"帅"的学生的平均成绩。

SQL: SELECT avg(T2.gradepoint) FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade  =  T2.lettergrade AND T1.StuID  =  T3.StuID WHERE T3.LName  =  "帅"
问题: 姓"帅"的学生平均成绩是多少？

SQL: SELECT avg(T2.gradepoint) FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade  =  T2.lettergrade AND T1.StuID  =  T3.StuID WHERE T3.LName  =  "帅"
问题: 住在“上海”的生的最高和最低分数是多少？

SQL: SELECT max(T2.gradepoint) ,  min(T2.gradepoint) FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade  =  T2.lettergrade AND T1.StuID  =  T3.StuID WHERE T3.city_code  =  "上海"
问题: 给出住在“上海”的学生的最高和最低分数。

SQL: SELECT max(T2.gradepoint) ,  min(T2.gradepoint) FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade  =  T2.lettergrade AND T1.StuID  =  T3.StuID WHERE T3.city_code  =  "上海"
问题: 查找学分为3学分或有1学分但有4学时的课程名称。

SQL: SELECT CName FROM COURSE WHERE Credits  =  3 UNION SELECT CName FROM COURSE WHERE Credits  =  1 AND Hours  =  4
问题: 学分为3学分或有1学分但有4学时的课程名称是什么？

SQL: SELECT CName FROM COURSE WHERE Credits  =  3 UNION SELECT CName FROM COURSE WHERE Credits  =  1 AND Hours  =  4
问题: 查找在“管理部”部门或在“财务部”部门和建筑“行政”的部门的名称。

SQL: SELECT DName FROM DEPARTMENT WHERE Division  =  "管理部" UNION SELECT DName FROM DEPARTMENT WHERE Division  =  "财务部" AND Building  =  "行政"
问题: 在“管理部”部门或在“财务部”部门和建筑“行政”部门的名称是什么？

SQL: SELECT DName FROM DEPARTMENT WHERE Division  =  "管理部" UNION SELECT DName FROM DEPARTMENT WHERE Division  =  "财务部" AND Building  =  "行政"
问题: 找到不参加任何课程的学生的名字。

SQL: SELECT Fname FROM STUDENT WHERE StuID NOT IN (SELECT StuID FROM ENROLLED_IN)
问题: 没有参加课程的所有学生的名字是什么？

SQL: SELECT Fname FROM STUDENT WHERE StuID NOT IN (SELECT StuID FROM ENROLLED_IN)
问题: 购买量前三大产品的id是什么？

SQL: SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3
问题: 给出购买金额最大的三种产品的ID。

SQL: SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3
问题: 最便宜产品的产品ID和产品类型是什么？

SQL: SELECT product_id ,  product_type_code FROM products ORDER BY product_price LIMIT 1
问题: 给出最低价格产品的ID和产品类型。

SQL: SELECT product_id ,  product_type_code FROM products ORDER BY product_price LIMIT 1
问题: 查找不同产品类型的数量。

SQL: SELECT count(DISTINCT product_type_code) FROM products
问题: 计算不同产品类型的数量。

SQL: SELECT count(DISTINCT product_type_code) FROM products
问题: 返回客户10的地址。

SQL: SELECT T1.address_details FROM addresses AS T1 JOIN customer_addresses AS T2 ON T1.address_id  =  T2.address_id WHERE T2.customer_id  =  10
问题: 客户ID为10的地址是什么？

SQL: SELECT T1.address_details FROM addresses AS T1 JOIN customer_addresses AS T2 ON T1.address_id  =  T2.address_id WHERE T2.customer_id  =  10
问题: 所有职称是“部门经理”的员工的id和性别是什么？

SQL: SELECT T1.staff_id ,  T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id WHERE T2.job_title_code  =  "部门经理"
问题: 返回任何职称是“部门经理”的员工的员工ID和性别。

SQL: SELECT T1.staff_id ,  T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id WHERE T2.job_title_code  =  "部门经理"
问题: 对于每个支付方法，返回多少客户使用它。

SQL: SELECT payment_method_code ,  count(*) FROM customers GROUP BY payment_method_code
问题: 每种付款方式有多少客户使用？

SQL: SELECT payment_method_code ,  count(*) FROM customers GROUP BY payment_method_code
问题: 最经常订购的产品的ID是什么？

SQL: SELECT product_id FROM order_items GROUP BY product_id ORDER BY count(*) DESC LIMIT 1
问题: 给最频繁订购的产品的ID。

SQL: SELECT product_id FROM order_items GROUP BY product_id ORDER BY count(*) DESC LIMIT 1
问题: 订单数量最多的客户的姓名、电话号码和电子邮件地址是什么？

SQL: SELECT T1.customer_name ,  T1.customer_phone ,  T1.customer_email FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T2.customer_id ORDER BY count(*) DESC LIMIT 1
问题: 返回订单最多的客户的姓名、电话号码和电子邮件地址。

SQL: SELECT T1.customer_name ,  T1.customer_phone ,  T1.customer_email FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T2.customer_id ORDER BY count(*) DESC LIMIT 1
问题: 每种产品的平均价格是多少？

SQL: SELECT product_type_code ,  avg(product_price) FROM products GROUP BY product_type_code
问题: 返回每个产品类型的平均价格。

SQL: SELECT product_type_code ,  avg(product_price) FROM products GROUP BY product_type_code
问题: “大洋”连锁店有多少家百货公司？

SQL: SELECT count(*) FROM department_stores AS T1 JOIN department_store_chain AS T2 ON T1.dept_store_chain_id  =  T2.dept_store_chain_id WHERE T2.dept_store_chain_name  =  "大洋"
问题: 算一下“大洋”连锁店的数量。

SQL: SELECT count(*) FROM department_stores AS T1 JOIN department_store_chain AS T2 ON T1.dept_store_chain_id  =  T2.dept_store_chain_id WHERE T2.dept_store_chain_name  =  "大洋"
问题: 最新指派的工作人员的姓名和职称是什么？

SQL: SELECT T1.staff_name ,  T2.job_title_code FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id ORDER BY T2.date_assigned_to DESC LIMIT 1
问题: 返回最新指派的工作人员的姓名和职称。

SQL: SELECT T1.staff_name ,  T2.job_title_code FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id ORDER BY T2.date_assigned_to DESC LIMIT 1
问题: 请告诉我由供应商ID是3提供的所有产品的类型、名称和价格。

SQL: SELECT T2.product_type_code ,  T2.product_name ,  T2.product_price FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id  =  T2.product_id WHERE T1.supplier_id  =  3
问题: 返回供应商3提供的产品类型、名称和价格。

SQL: SELECT T2.product_type_code ,  T2.product_name ,  T2.product_price FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id  =  T2.product_id WHERE T1.supplier_id  =  3
问题: 按照客户id的顺序返回订单状态为“延迟”的客户的不同名字。

SQL: SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.order_status_code  =  "延迟" ORDER BY T2.customer_id
问题: 按客户ID排序的具有“延迟”订单状态的客户的不同名字是什么？

SQL: SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.order_status_code  =  "延迟" ORDER BY T2.customer_id
问题: 查找既有“新”订单又有“延迟”订单的客户的名称和地址。

SQL: SELECT T1.customer_name ,  T1.customer_address 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 ,  T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.order_status_code  =  "延迟"
问题: 既有“新”订单又有“延迟”的客户的姓名和地址是什么？

SQL: SELECT T1.customer_name ,  T1.customer_address 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 ,  T1.customer_address FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.order_status_code  =  "延迟"
问题: 返回由供应商ID2供应并且比所有产品的平均价格更贵的所有产品的ID。

SQL: SELECT T1.product_id FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id  =  T2.product_id WHERE T1.supplier_id  =  2 AND T2.product_price  >  (SELECT avg(product_price) FROM products)
问题: 来自id 2的供应商的产品的id且比所有产品的平均价格都贵的是id什么？

SQL: SELECT T1.product_id FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id  =  T2.product_id WHERE T1.supplier_id  =  2 AND T2.product_price  >  (SELECT avg(product_price) FROM products)
问题: 有“市场”部和“管理”部的百货公司的id和名称是什么？

SQL: SELECT T2.dept_store_id ,  T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id  =  T2.dept_store_id WHERE T1.department_name  =  "市场" INTERSECT SELECT T2.dept_store_id ,  T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id  =  T2.dept_store_id WHERE T1.department_name  =  "管理"
问题: 既有“市场”部又有“管理”部百货公司的id和名称是什么？

SQL: SELECT T2.dept_store_id ,  T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id  =  T2.dept_store_id WHERE T1.department_name  =  "市场" INTERSECT SELECT T2.dept_store_id ,  T2.store_name FROM departments AS T1 JOIN department_stores AS T2 ON T1.dept_store_id  =  T2.dept_store_id WHERE T1.department_name  =  "管理"
问题: 百货商店数量最多的两家连锁店的ID是什么？

SQL: SELECT dept_store_chain_id FROM department_stores GROUP BY dept_store_chain_id ORDER BY count(*) DESC LIMIT 2
问题: 返回百货商店数量最多的两家连锁店的ID。

SQL: SELECT dept_store_chain_id FROM department_stores GROUP BY dept_store_chain_id ORDER BY count(*) DESC LIMIT 2
问题: 员工人数最少的部门的id是什么？

SQL: SELECT department_id FROM staff_department_assignments GROUP BY department_id ORDER BY count(*) LIMIT 1
问题: 返回员工人数最少的部门的id。

SQL: SELECT department_id FROM staff_department_assignments GROUP BY department_id ORDER BY count(*) LIMIT 1
问题: 对于每种产品类型，返回最高和最低价格。

SQL: SELECT product_type_code ,  max(product_price) ,  min(product_price) FROM products GROUP BY product_type_code
问题: 每种产品的最高和最低的产品价格是多少？

SQL: SELECT product_type_code ,  max(product_price) ,  min(product_price) FROM products GROUP BY product_type_code
问题: 找出平均价格高于所有产品平均价格的产品类型。

SQL: SELECT product_type_code FROM products GROUP BY product_type_code HAVING avg(product_price)  >  (SELECT avg(product_price) FROM products)
问题: 该类型产品的平均价格高于所有产品平均价格的产品类型的代码是什么？

SQL: SELECT product_type_code FROM products GROUP BY product_type_code HAVING avg(product_price)  >  (SELECT avg(product_price) FROM products)
问题: 找到被指派时间最短的员工的id和姓名。

SQL: SELECT T1.staff_id ,  T1.staff_name FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id  =  T2.staff_id ORDER BY date_assigned_to - date_assigned_from LIMIT 1
问题: 被指派时间最短的员工的id和姓名是什么？

SQL: SELECT T1.staff_id ,  T1.staff_name FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id  =  T2.staff_id ORDER BY date_assigned_to - date_assigned_from LIMIT 1
问题: 返回所有价格在600到700之间的产品的名称和ID。

SQL: SELECT product_name ,  product_id FROM products WHERE product_price BETWEEN 600 AND 700
问题: 所有价格在600到700之间的产品的名称和ID是什么？

SQL: SELECT product_name ,  product_id FROM products WHERE product_price BETWEEN 600 AND 700
问题: 查找所有在“取消”某些订单后又有订购的不同客户的ID。

SQL: SELECT DISTINCT customer_id FROM Customer_Orders WHERE order_date  >  (SELECT min(order_date) FROM Customer_Orders WHERE order_status_code  =  "取消")
问题: 在“取消”某些订单后又有订购的不同客户的ID是什么？

SQL: SELECT DISTINCT customer_id FROM Customer_Orders WHERE order_date  >  (SELECT min(order_date) FROM Customer_Orders WHERE order_status_code  =  "取消")
问题: 那些比“文书职员”更早被分配到职员部的职员的id是什么？

SQL: SELECT staff_id FROM Staff_Department_Assignments WHERE date_assigned_to  <  (SELECT max(date_assigned_to) FROM Staff_Department_Assignments WHERE job_title_code  =  '文书职员')
问题: 返回比“文书职员”更早被分配到职员部的职员的id。

SQL: SELECT staff_id FROM Staff_Department_Assignments WHERE date_assigned_to  <  (SELECT max(date_assigned_to) FROM Staff_Department_Assignments WHERE job_title_code  =  '文书职员')
问题: 地址包含“巷”的客户名称和ID是什么？

SQL: SELECT customer_name ,  customer_id FROM customers WHERE customer_address LIKE "巷"
问题: 返回地址包含“巷”的客户名称和ID。

SQL: SELECT customer_name ,  customer_id FROM customers WHERE customer_address LIKE "巷"
问题: 返回在“2016”年被指派的工作人员的姓名和性别。

SQL: SELECT T1.staff_name ,  T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id WHERE T2.date_assigned_from LIKE "2016"
问题: 在“2016”年被指派的工作人员的姓名和性别是什么？

SQL: SELECT T1.staff_name ,  T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id WHERE T2.date_assigned_from LIKE "2016"
问题: 列出被指派多个工作岗位的员工的姓名。

SQL: SELECT T1.staff_name FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id GROUP BY T2.staff_id HAVING COUNT (*)  >  1
问题: 被指派了多个工作岗位的员工的姓名是什么？

SQL: SELECT T1.staff_name FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id  =  T2.staff_id GROUP BY T2.staff_id HAVING COUNT (*)  >  1
问题: 按地址的字母顺序列出所有供应商的名称和电话号码。

SQL: SELECT T1.supplier_name ,  T1.supplier_phone FROM Suppliers AS T1 JOIN supplier_addresses AS T2 ON T1.supplier_id  =  T2.supplier_id JOIN addresses AS T3 ON T2.address_id  =  T3.address_id ORDER BY T3.address_details
问题: 按地址的字母顺序排列的所有供应商的姓名和电话号码是什么？

SQL: SELECT T1.supplier_name ,  T1.supplier_phone FROM Suppliers AS T1 JOIN supplier_addresses AS T2 ON T1.supplier_id  =  T2.supplier_id JOIN addresses AS T3 ON T2.address_id  =  T3.address_id ORDER BY T3.address_details
问题: 所有客户和供应商的电话号码是多少？

SQL: SELECT customer_phone FROM customers UNION SELECT supplier_phone FROM suppliers
问题: 返回所有客户和供应商的电话号码。

SQL: SELECT customer_phone FROM customers UNION SELECT supplier_phone FROM suppliers
问题: 返回所有订购三次以上或购买金额为80000以上的产品的标识。

SQL: SELECT product_id FROM Order_Items GROUP BY product_id HAVING count(*)  >  3 UNION SELECT product_id FROM Product_Suppliers GROUP BY product_id HAVING sum(total_amount_purchased)  >  80000
问题: 订购次数超过3次或累计购买金额超过80000的所有产品的标识是什么？

SQL: SELECT product_id FROM Order_Items GROUP BY product_id HAVING count(*)  >  3 UNION SELECT product_id FROM Product_Suppliers GROUP BY product_id HAVING sum(total_amount_purchased)  >  80000
问题: 价格低于600或高于900的产品的id和名称是什么？

SQL: SELECT product_id ,  product_name FROM products WHERE product_price  <  600 OR product_price  >  900
问题: 给出价格低于600或高于900的产品的ID和名称。

SQL: SELECT product_id ,  product_name FROM products WHERE product_price  <  600 OR product_price  >  900
问题: 查找平均每件产品购买量在50000以上或低于30000的供应商的ID。

SQL: SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id HAVING avg(total_amount_purchased)  >  50000 OR avg(total_amount_purchased)  <  30000
问题: 平均购买量在50000以上或低于30000的供应商的id是什么？

SQL: SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id HAVING avg(total_amount_purchased)  >  50000 OR avg(total_amount_purchased)  <  30000
问题: 供应最多产品的供应商购买的平均数量和购买的金额是多少？

SQL: SELECT avg(total_amount_purchased) ,  avg(total_value_purchased) FROM Product_Suppliers WHERE supplier_id  =  (SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id ORDER BY count(*) DESC LIMIT 1)
问题: 返回供应最多产品的供应商购买的平均数量和购买的金额。

SQL: SELECT avg(total_amount_purchased) ,  avg(total_value_purchased) FROM Product_Suppliers WHERE supplier_id  =  (SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id ORDER BY count(*) DESC LIMIT 1)
问题: 最大和最小的客户代码是什么？

SQL: SELECT max(customer_code) ,  min(customer_code) FROM Customers
问题: 返回客户代码的最大值和最小值。

SQL: SELECT max(customer_code) ,  min(customer_code) FROM Customers