context
stringlengths
28
393
answer
stringlengths
17
532
question
stringlengths
5
112
CREATE TABLE shop (num_of_staff INTEGER, score INTEGER)
SELECT AVG(num_of_staff), AVG(score) FROM shop
所有商店的平均分和平均员工数是多少?
CREATE TABLE shop (address VARCHAR, shop_id VARCHAR, score INTEGER)
SELECT shop_id, address FROM shop WHERE score < (SELECT AVG(score) FROM shop)
找出得分低于平均分的商店的ID和地址。
CREATE TABLE shop (address VARCHAR, shop_id VARCHAR, num_of_staff VARCHAR), CREATE TABLE happy_hour (address VARCHAR, shop_id VARCHAR, num_of_staff VARCHAR)
SELECT address, num_of_staff FROM shop WHERE NOT shop_id IN (SELECT shop_id FROM happy_hour)
找到没有快乐时间的商店的地址和员工数量。
CREATE TABLE shop (address VARCHAR, shop_id VARCHAR), CREATE TABLE happy_hour (shop_id VARCHAR)
SELECT t1.address, t1.shop_id FROM shop AS t1 JOIN happy_hour AS t2 ON t1.shop_id = t2.shop_id WHERE MONTH = '五月'
五月份有一个欢乐时间的商店的ID和地址是什么?
CREATE TABLE happy_hour (shop_id VARCHAR)
SELECT shop_id, COUNT(*) FROM happy_hour GROUP BY shop_id ORDER BY COUNT(*) DESC LIMIT 1
哪个商店的开心时间最多?列出它的ID和快乐时间的数量。
CREATE TABLE happy_hour (MONTH VARCHAR)
SELECT MONTH FROM happy_hour GROUP BY MONTH ORDER BY COUNT(*) DESC LIMIT 1
哪一个月有最多的快乐时间?
CREATE TABLE happy_hour (MONTH VARCHAR)
SELECT MONTH FROM happy_hour GROUP BY MONTH HAVING COUNT(*) > 2
哪几个月有超过2个快乐时间?
CREATE TABLE ALBUM (Id VARCHAR)
SELECT COUNT(*) FROM ALBUM
有多少张专辑?
CREATE TABLE ALBUM (Id VARCHAR)
SELECT COUNT(*) FROM ALBUM
找到专辑的数量。
CREATE TABLE GENRE (Name VARCHAR)
SELECT Name FROM GENRE
列出所有音乐流派的名称。
CREATE TABLE GENRE (Name VARCHAR)
SELECT Name FROM GENRE
不同音乐流派的名字是什么?
CREATE TABLE CUSTOMER (State VARCHAR)
SELECT * FROM CUSTOMER WHERE State = "广东"
查找“广东”州所有客户信息。
CREATE TABLE CUSTOMER (State VARCHAR)
SELECT * FROM CUSTOMER WHERE State = "广东"
“广东”州客户的所有客户信息是什么?
CREATE TABLE EMPLOYEE (FirstName VARCHAR, City VARCHAR, LastName VARCHAR)
SELECT FirstName, LastName FROM EMPLOYEE WHERE City = "青岛"
住在“青岛”市的员工的名字和姓是什么?
CREATE TABLE EMPLOYEE (FirstName VARCHAR, City VARCHAR, LastName VARCHAR)
SELECT FirstName, LastName FROM EMPLOYEE WHERE City = "青岛"
查找居住在“青岛”市的雇员的全名。
CREATE TABLE INVOICE (BillingCountry VARCHAR)
SELECT DISTINCT (BillingCountry) FROM INVOICE
不同发票的收费国家有哪些?
CREATE TABLE INVOICE (BillingCountry VARCHAR)
SELECT DISTINCT (BillingCountry) FROM INVOICE
查找所有发票不同的收费国家。
CREATE TABLE ARTIST (Name VARCHAR)
SELECT Name FROM ARTIST WHERE Name LIKE "安"
找出所有名字中有“a”的艺术家的名字。
CREATE TABLE ARTIST (Name VARCHAR)
SELECT Name FROM ARTIST WHERE Name LIKE "安"
名字中有字母“a”的艺术家有哪些?
CREATE TABLE ALBUM (ArtistId VARCHAR), CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR)
SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "吴亦凡"
找到“吴亦凡”艺术家的所有专辑的标题。
CREATE TABLE ALBUM (ArtistId VARCHAR), CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR)
SELECT Title FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "吴亦凡"
“吴亦凡”艺术家的专辑的标题是什么?
CREATE TABLE ALBUM (ArtistId VARCHAR), CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR)
SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "陈奕迅"
“陈奕迅”艺术家有多少张专辑?
CREATE TABLE ALBUM (ArtistId VARCHAR), CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR)
SELECT COUNT(*) FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T2.Name = "陈奕迅"
找到“陈奕迅”艺术家的专辑数量。
CREATE TABLE ALBUM (ArtistId VARCHAR, Title VARCHAR), CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR)
SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = "奇幻旅程"
“奇幻旅程”专辑是哪一位艺术家?
CREATE TABLE ALBUM (ArtistId VARCHAR, Title VARCHAR), CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR)
SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = "奇幻旅程"
找到制作“奇幻旅程”专辑艺术家的名字。
CREATE TABLE ALBUM (ArtistId VARCHAR), CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR)
SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId GROUP BY T2.Name ORDER BY COUNT(*) DESC LIMIT 1
哪位艺术家的专辑最多?
CREATE TABLE ALBUM (ArtistId VARCHAR), CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR)
SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId GROUP BY T2.Name ORDER BY COUNT(*) DESC LIMIT 1
专辑数量最多的艺人叫什么名字?
CREATE TABLE TRACK (Name VARCHAR)
SELECT Name FROM TRACK WHERE Name LIKE '你'
找出包含“你”这个词的所有曲目的名字。
CREATE TABLE TRACK (Name VARCHAR)
SELECT Name FROM TRACK WHERE Name LIKE '你'
包含了“你”这个词的曲目的名字是什么?
CREATE TABLE TRACK (UnitPrice INTEGER)
SELECT AVG(UnitPrice) FROM TRACK
所有歌曲的平均单价是多少?
CREATE TABLE TRACK (UnitPrice INTEGER)
SELECT AVG(UnitPrice) FROM TRACK
找到歌曲的平均单价。
CREATE TABLE TRACK (Milliseconds INTEGER)
SELECT MAX(Milliseconds), MIN(Milliseconds) FROM TRACK
最长和最短的歌曲的持续时间是多少毫秒?
CREATE TABLE TRACK (Milliseconds INTEGER)
SELECT MAX(Milliseconds), MIN(Milliseconds) FROM TRACK
找到毫秒下歌曲的最大和最小持续时间。
CREATE TABLE ALBUM (Title VARCHAR, AlbumId VARCHAR), CREATE TABLE TRACK (AlbumID VARCHAR, AlbumId VARCHAR)
SELECT T1.Title, T2.AlbumID, COUNT(*) FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.AlbumID
显示专辑名称、ID和每张专辑的曲目数量。
CREATE TABLE ALBUM (Title VARCHAR, AlbumId VARCHAR), CREATE TABLE TRACK (AlbumID VARCHAR, AlbumId VARCHAR)
SELECT T1.Title, T2.AlbumID, COUNT(*) FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.AlbumID
不同专辑的名称和ID是什么?每个专辑有多少首曲目?
CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR), CREATE TABLE TRACK (GenreId VARCHAR)
SELECT T1.Name FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId GROUP BY T2.GenreId ORDER BY COUNT(*) DESC LIMIT 1
所有曲目中最常见的类型是什么?
CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR), CREATE TABLE TRACK (GenreId VARCHAR)
SELECT T1.Name FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId GROUP BY T2.GenreId ORDER BY COUNT(*) DESC LIMIT 1
找出所有曲目中最常见的类型的名称。
CREATE TABLE MEDIATYPE (MediaTypeId VARCHAR, Name VARCHAR), CREATE TABLE TRACK (MediaTypeId VARCHAR)
SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*) ASC LIMIT 1
在所有歌曲中最常见的媒体类型是什么?
CREATE TABLE MEDIATYPE (MediaTypeId VARCHAR, Name VARCHAR), CREATE TABLE TRACK (MediaTypeId VARCHAR)
SELECT T1.Name FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId GROUP BY T2.MediaTypeId ORDER BY COUNT(*) ASC LIMIT 1
在所有音乐中,什么类型的媒体类型是最不常见的?
CREATE TABLE ALBUM (Title VARCHAR, AlbumId VARCHAR), CREATE TABLE TRACK (AlbumID VARCHAR, UnitPrice INTEGER, AlbumId VARCHAR)
SELECT T1.Title, T2.AlbumID FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 GROUP BY T2.AlbumID
显示包含单价大于1的曲目的专辑的名称和ID。
CREATE TABLE ALBUM (Title VARCHAR, AlbumId VARCHAR), CREATE TABLE TRACK (AlbumID VARCHAR, UnitPrice INTEGER, AlbumId VARCHAR)
SELECT T1.Title, T2.AlbumID FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 GROUP BY T2.AlbumID
包含单价大于1的歌曲的专辑的标题和ID是什么?
CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR), CREATE TABLE TRACK (GenreId VARCHAR)
SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "摇滚"
摇滚流派有多少曲目?
CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR), CREATE TABLE TRACK (GenreId VARCHAR)
SELECT COUNT(*) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "摇滚"
计算摇滚类型的歌曲的数量。
CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR), CREATE TABLE TRACK (GenreId VARCHAR)
SELECT AVG(UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "爵士"
属于爵士乐风格的曲目的平均单价是多少?
CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR), CREATE TABLE TRACK (GenreId VARCHAR)
SELECT AVG(UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "爵士"
找到爵士乐曲目的平均单价。
CREATE TABLE CUSTOMER (FirstName VARCHAR, Email VARCHAR, LastName VARCHAR)
SELECT FirstName, LastName FROM CUSTOMER WHERE Email = "luisg@embraer.com.br"
电子邮件为“luisg@embraer.com.br”的客户的名字和姓是什么?
CREATE TABLE CUSTOMER (FirstName VARCHAR, Email VARCHAR, LastName VARCHAR)
SELECT FirstName, LastName FROM CUSTOMER WHERE Email = "luisg@embraer.com.br"
查找电子邮件“luisg@embraer.com.br”的客户的全名。
CREATE TABLE CUSTOMER (Email VARCHAR)
SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE "qq.com"
有多少客户有电子邮件包含"gmail.com"?
CREATE TABLE CUSTOMER (Email VARCHAR)
SELECT COUNT(*) FROM CUSTOMER WHERE Email LIKE "qq.com"
计算包含"gmail.com"的电子邮件的客户数量。
CREATE TABLE CUSTOMER (FirstName VARCHAR, SupportRepId VARCHAR), CREATE TABLE EMPLOYEE (FirstName VARCHAR, EmployeeId VARCHAR, LastName VARCHAR)
SELECT T2.FirstName, T2.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.FirstName = "小红"
帮助过名为“小红”的客户的员工的名字和姓氏是什么?
CREATE TABLE CUSTOMER (FirstName VARCHAR, SupportRepId VARCHAR), CREATE TABLE EMPLOYEE (FirstName VARCHAR, EmployeeId VARCHAR, LastName VARCHAR)
SELECT T2.FirstName, T2.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.FirstName = "小红"
查找帮助客户“小红”的员工的全名。
CREATE TABLE CUSTOMER (PostalCode VARCHAR, SupportRepId VARCHAR), CREATE TABLE EMPLOYEE (EmployeeId VARCHAR, City VARCHAR)
SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.PostalCode = "70174"
帮助住在邮政编码为“70174”的客户的员工住在哪个城市?
CREATE TABLE CUSTOMER (PostalCode VARCHAR, SupportRepId VARCHAR), CREATE TABLE EMPLOYEE (EmployeeId VARCHAR, City VARCHAR)
SELECT T2.City FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId WHERE T1.PostalCode = "70174"
找到帮助使用邮政编码“70174”的客户的雇员相对应的城市。
CREATE TABLE EMPLOYEE (city VARCHAR)
SELECT COUNT(DISTINCT city) FROM EMPLOYEE
员工住多少个不同的城市?
CREATE TABLE EMPLOYEE (city VARCHAR)
SELECT COUNT(DISTINCT city) FROM EMPLOYEE
找到员工居住的不同城市的数量。
CREATE TABLE CUSTOMER (CustomerId VARCHAR, FirstName VARCHAR), CREATE TABLE INVOICE (CustomerId VARCHAR, InvoiceDate VARCHAR)
SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = "卢" AND LastName = "军"
查找与名为“卢”姓为“军”的客户相对应的所有发票日期。
CREATE TABLE CUSTOMER (CustomerId VARCHAR, FirstName VARCHAR), CREATE TABLE INVOICE (CustomerId VARCHAR, InvoiceDate VARCHAR)
SELECT T2.InvoiceDate FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = "卢" AND LastName = "军"
名是“卢”姓是“军”的客户的发票日期是什么?
CREATE TABLE CUSTOMER (CustomerId VARCHAR, LastName VARCHAR), CREATE TABLE Invoice (CustomerId VARCHAR, total INTEGER)
SELECT LastName FROM CUSTOMER EXCEPT SELECT T1.LastName FROM CUSTOMER AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T2.total > 20
查找所有发票总额没有大于20的客户姓氏。
CREATE TABLE CUSTOMER (CustomerId VARCHAR, LastName VARCHAR), CREATE TABLE Invoice (CustomerId VARCHAR, total INTEGER)
SELECT LastName FROM CUSTOMER EXCEPT SELECT T1.LastName FROM CUSTOMER AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T2.total > 20
发票总额不超过20的客户的姓氏是什么?
CREATE TABLE CUSTOMER (FirstName VARCHAR, country VARCHAR, CustomerId VARCHAR), CREATE TABLE INVOICE (CustomerId VARCHAR)
SELECT DISTINCT T1.FirstName FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = "巴西"
查找居住在“巴西”的有发票的所有客户的名字。
CREATE TABLE CUSTOMER (FirstName VARCHAR, country VARCHAR, CustomerId VARCHAR), CREATE TABLE INVOICE (CustomerId VARCHAR)
SELECT DISTINCT T1.FirstName FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = "巴西"
对于来自“巴西”有发票的顾客,他们有什么不同的名字?
CREATE TABLE CUSTOMER (CustomerId VARCHAR, country VARCHAR, Address VARCHAR), CREATE TABLE INVOICE (CustomerId VARCHAR)
SELECT DISTINCT T1.Address FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = "德国"
查找所有居住在“德国”有发票的客户的地址。
CREATE TABLE CUSTOMER (CustomerId VARCHAR, country VARCHAR, Address VARCHAR), CREATE TABLE INVOICE (CustomerId VARCHAR)
SELECT DISTINCT T1.Address FROM CUSTOMER AS T1 JOIN INVOICE AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.country = "德国"
在“德国”居住的有发票的客户地址是什么?
CREATE TABLE EMPLOYEE (Phone VARCHAR)
SELECT Phone FROM EMPLOYEE
列出所有员工的电话号码。
CREATE TABLE EMPLOYEE (Phone VARCHAR)
SELECT Phone FROM EMPLOYEE
每个员工的电话号码是什么?
CREATE TABLE MEDIATYPE (MediaTypeId VARCHAR, Name VARCHAR), CREATE TABLE TRACK (MediaTypeId VARCHAR)
SELECT COUNT(*) FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId WHERE T1.Name = "AAC"
有多少歌是“AAC”媒体类型?
CREATE TABLE MEDIATYPE (MediaTypeId VARCHAR, Name VARCHAR), CREATE TABLE TRACK (MediaTypeId VARCHAR)
SELECT COUNT(*) FROM MEDIATYPE AS T1 JOIN TRACK AS T2 ON T1.MediaTypeId = T2.MediaTypeId WHERE T1.Name = "AAC"
计算媒体类型为“AAC”的歌曲数。
CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR), CREATE TABLE TRACK (GenreId VARCHAR)
SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "拉丁" OR T1.Name = "流行"
属于“拉丁”和“流行”音乐的曲目平均持续时间是几毫秒?
CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR), CREATE TABLE TRACK (GenreId VARCHAR)
SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "拉丁" OR T1.Name = "流行"
找到“拉丁”和“流行”歌曲的平均毫秒长度。
CREATE TABLE CUSTOMER (FirstName VARCHAR, SupportRepId VARCHAR), CREATE TABLE EMPLOYEE (EmployeeId VARCHAR)
SELECT T1.FirstName, T1.SupportRepId FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) >= 10
请出示为至少10位客户服务的员工姓名和ID。
CREATE TABLE CUSTOMER (FirstName VARCHAR, SupportRepId VARCHAR), CREATE TABLE EMPLOYEE (EmployeeId VARCHAR)
SELECT T1.FirstName, T1.SupportRepId FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) >= 10
为10个或更多客户服务的员工的名字和支持代表ID的是什么?
CREATE TABLE CUSTOMER (SupportRepId VARCHAR, LastName VARCHAR), CREATE TABLE EMPLOYEE (EmployeeId VARCHAR)
SELECT T1.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) <= 20
请显示为不超过20名顾客服务的雇员的姓氏。
CREATE TABLE CUSTOMER (SupportRepId VARCHAR, LastName VARCHAR), CREATE TABLE EMPLOYEE (EmployeeId VARCHAR)
SELECT T1.LastName FROM CUSTOMER AS T1 JOIN EMPLOYEE AS T2 ON T1.SupportRepId = T2.EmployeeId GROUP BY T1.SupportRepId HAVING COUNT(*) <= 20
服务最多20名顾客的员工的姓氏是什么?
CREATE TABLE ALBUM (Title VARCHAR)
SELECT Title FROM ALBUM ORDER BY Title
请按字母顺序列出所有唱片的标题。
CREATE TABLE ALBUM (Title VARCHAR)
SELECT Title FROM ALBUM ORDER BY Title
所有的专辑标题是什么,按字母顺序排列?
CREATE TABLE ALBUM (ArtistId VARCHAR), CREATE TABLE ARTIST (ArtistID VARCHAR, Name VARCHAR)
SELECT T2.Name, T1.ArtistId FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistID GROUP BY T1.ArtistId HAVING COUNT(*) >= 3 ORDER BY T2.Name
请按字母顺序列出至少有3张专辑的所有艺术家的姓名和ID。
CREATE TABLE ALBUM (ArtistId VARCHAR), CREATE TABLE ARTIST (ArtistID VARCHAR, Name VARCHAR)
SELECT T2.Name, T1.ArtistId FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistID GROUP BY T1.ArtistId HAVING COUNT(*) >= 3 ORDER BY T2.Name
按字母顺序排列,有3张或更多张专辑的艺术家的名字和ID是什么?
CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR), CREATE TABLE ALBUM (ArtistId VARCHAR)
SELECT Name FROM ARTIST EXCEPT SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId
找到没有任何专辑的艺术家的名字。
CREATE TABLE ARTIST (ArtistId VARCHAR, Name VARCHAR), CREATE TABLE ALBUM (ArtistId VARCHAR)
SELECT Name FROM ARTIST EXCEPT SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId
没有发行任何专辑的艺术家的名字是什么?
CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR), CREATE TABLE TRACK (UnitPrice INTEGER, GenreId VARCHAR)
SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "摇滚"
摇滚歌曲的平均单价是多少?
CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR), CREATE TABLE TRACK (UnitPrice INTEGER, GenreId VARCHAR)
SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "摇滚"
找出摇滚流派的歌曲的平均单价。
CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR), CREATE TABLE TRACK (GenreId VARCHAR)
SELECT MAX(Milliseconds), MIN(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "流行"
最长和最短的流行歌曲的持续时间是多少毫秒?
CREATE TABLE GENRE (GenreId VARCHAR, Name VARCHAR), CREATE TABLE TRACK (GenreId VARCHAR)
SELECT MAX(Milliseconds), MIN(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "流行"
找出流行音乐的最大和最小毫秒长度。
CREATE TABLE EMPLOYEE (BirthDate VARCHAR, City VARCHAR)
SELECT BirthDate FROM EMPLOYEE WHERE City = "长沙"
住在“长沙”市的员工的出生日期是多少?
CREATE TABLE EMPLOYEE (BirthDate VARCHAR, City VARCHAR)
SELECT BirthDate FROM EMPLOYEE WHERE City = "长沙"
查找在“长沙”市居住的雇员的出生日期。
CREATE TABLE TRACK (UnitPrice VARCHAR)
SELECT DISTINCT (UnitPrice) FROM TRACK
所有歌曲的不同单价是多少?
CREATE TABLE TRACK (UnitPrice VARCHAR)
SELECT DISTINCT (UnitPrice) FROM TRACK
找到歌曲的不同单价。
CREATE TABLE ARTIST (artistid VARCHAR), CREATE TABLE ALBUM (artistid VARCHAR)
SELECT COUNT(*) FROM ARTIST WHERE NOT artistid IN (SELECT artistid FROM ALBUM)
有多少艺术家没有专辑?
CREATE TABLE ARTIST (artistid VARCHAR), CREATE TABLE ALBUM (artistid VARCHAR)
SELECT COUNT(*) FROM ARTIST WHERE NOT artistid IN (SELECT artistid FROM ALBUM)
数出没有发行专辑的艺术家的数量。
CREATE TABLE Album (Title VARCHAR, AlbumId VARCHAR), CREATE TABLE Track (GenreID VARCHAR, AlbumId VARCHAR), CREATE TABLE Genre (GenreID VARCHAR, Name VARCHAR)
SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = '雷鬼' INTERSECT SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = '摇滚'
包含“雷鬼”和“摇滚”流派曲目的专辑的名称是什么?
CREATE TABLE Album (Title VARCHAR, AlbumId VARCHAR), CREATE TABLE Track (GenreID VARCHAR, AlbumId VARCHAR), CREATE TABLE Genre (GenreID VARCHAR, Name VARCHAR)
SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = '雷鬼' INTERSECT SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId JOIN Genre AS T3 ON T2.GenreID = T3.GenreID WHERE T3.Name = '摇滚'
查找包含“雷鬼”和“摇滚”音乐曲目的专辑标题。
CREATE TABLE available_policies (customer_phone VARCHAR)
SELECT customer_phone FROM available_policies
找到所有的电话号码。
CREATE TABLE available_policies (customer_phone VARCHAR)
SELECT customer_phone FROM available_policies
所有电话号码是多少?
CREATE TABLE available_policies (policy_type_code VARCHAR, customer_phone VARCHAR)
SELECT customer_phone FROM available_policies WHERE policy_type_code = "人寿保险"
“人寿保险”保险单下的客户电话号码是多少?
CREATE TABLE available_policies (policy_type_code VARCHAR, customer_phone VARCHAR)
SELECT customer_phone FROM available_policies WHERE policy_type_code = "人寿保险"
使用代号为“人寿保险”的保险单的客户的电话号码是多少?
CREATE TABLE available_policies (policy_type_code VARCHAR)
SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1
哪种保险单类型在数据库中的记录最多?
CREATE TABLE available_policies (policy_type_code VARCHAR)
SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1
哪些保险单类型在保险单中出现最多?
CREATE TABLE available_policies (policy_type_code VARCHAR, customer_phone VARCHAR)
SELECT customer_phone FROM available_policies WHERE policy_type_code = (SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1)
最流行的保险单类型的所有的客户电话号码是什么?
CREATE TABLE available_policies (policy_type_code VARCHAR, customer_phone VARCHAR)
SELECT customer_phone FROM available_policies WHERE policy_type_code = (SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1)
查找使用可用保险单中最常见保险单类型的客户的电话号码。
CREATE TABLE available_policies (policy_type_code VARCHAR)
SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING COUNT(*) > 4
查找超过4个客户使用的保险单类型。