answer
stringlengths 18
552
| context
stringlengths 30
393
| question
stringlengths 5
73
|
---|---|---|
SELECT date FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31 | CREATE TABLE weather (date VARCHAR, mean_sea_level_pressure_inches INTEGER) | 哪些日子的平均海平面气压在30.3到31之间? |
SELECT date , max_temperature_f - min_temperature_f FROM weather ORDER BY max_temperature_f - min_temperature_f LIMIT 1 | CREATE TABLE weather (min_temperature_f VARCHAR, date VARCHAR, max_temperature_f VARCHAR) | 找出最大温度与最小温度之差最小的一天。并报告差异。 |
SELECT date , max_temperature_f - min_temperature_f FROM weather ORDER BY max_temperature_f - min_temperature_f LIMIT 1 | CREATE TABLE weather (min_temperature_f VARCHAR, date VARCHAR, max_temperature_f VARCHAR) | 哪些天具有最小的温度范围,那个范围是什么? |
SELECT DISTINCT T1.id , T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available > 12 | CREATE TABLE station (name VARCHAR, id VARCHAR), CREATE TABLE status (station_id VARCHAR, bikes_available INTEGER) | 有超过12辆可用自行车的车站的ID和名称是什么? |
SELECT DISTINCT T1.id , T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available > 12 | CREATE TABLE station (name VARCHAR, id VARCHAR), CREATE TABLE status (station_id VARCHAR, bikes_available INTEGER) | 有超过12辆可用自行车的车站有哪些不同的ID和名称? |
SELECT zip_code FROM weather GROUP BY zip_code HAVING avg(mean_humidity) < 70 INTERSECT SELECT zip_code FROM trip GROUP BY zip_code HAVING count(*) >= 100 | CREATE TABLE weather (mean_humidity INTEGER, zip_code VARCHAR), CREATE TABLE trip (mean_humidity INTEGER, zip_code VARCHAR) | 给我平均湿度低于70,至少有100个路线的地区邮编。 |
SELECT zip_code FROM weather GROUP BY zip_code HAVING avg(mean_humidity) < 70 INTERSECT SELECT zip_code FROM trip GROUP BY zip_code HAVING count(*) >= 100 | CREATE TABLE weather (mean_humidity INTEGER, zip_code VARCHAR), CREATE TABLE trip (mean_humidity INTEGER, zip_code VARCHAR) | 平均湿度低于70并且至少有100次旅行的邮政编码是什么? |
SELECT name FROM station WHERE city = "西安" EXCEPT SELECT end_station_name FROM trip GROUP BY end_station_name HAVING count(*) > 100 | CREATE TABLE station (end_station_name VARCHAR, name VARCHAR, city VARCHAR), CREATE TABLE trip (end_station_name VARCHAR, name VARCHAR, city VARCHAR) | 位于“西安”市但没能成为100次以上路线的终点的车站叫什么名字? |
SELECT name FROM station WHERE city = "西安" EXCEPT SELECT end_station_name FROM trip GROUP BY end_station_name HAVING count(*) > 100 | CREATE TABLE station (end_station_name VARCHAR, name VARCHAR, city VARCHAR), CREATE TABLE trip (end_station_name VARCHAR, name VARCHAR, city VARCHAR) | 位于“西安”但从未成为路线终点的车站叫什么名字? |
SELECT count(*) FROM station AS T1 JOIN trip AS T2 JOIN station AS T3 JOIN trip AS T4 ON T1.id = T2.start_station_id AND T2.id = T4.id AND T3.id = T4.end_station_id WHERE T1.city = "重庆" AND T3.city = "西安" | CREATE TABLE station (city VARCHAR, id VARCHAR), CREATE TABLE trip (end_station_id VARCHAR, id VARCHAR) | 从“重庆”出发到“西安”有多少路线? |
SELECT count(*) FROM station AS T1 JOIN trip AS T2 JOIN station AS T3 JOIN trip AS T4 ON T1.id = T2.start_station_id AND T2.id = T4.id AND T3.id = T4.end_station_id WHERE T1.city = "重庆" AND T3.city = "西安" | CREATE TABLE station (city VARCHAR, id VARCHAR), CREATE TABLE trip (end_station_id VARCHAR, id VARCHAR) | 从“重庆”的一个车站到“西安”的一个车站,总共有多少次旅行? |
SELECT avg(T1.lat) , avg(T1.long) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id | CREATE TABLE station (lat INTEGER, long INTEGER, id VARCHAR), CREATE TABLE trip (start_station_id VARCHAR) | 所有路线起点的平均纬度和经度是多少? |
SELECT avg(T1.lat) , avg(T1.long) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id | CREATE TABLE station (lat INTEGER, long INTEGER, id VARCHAR), CREATE TABLE trip (start_station_id VARCHAR) | 所有出发站的平均纬度和经度是多少? |
SELECT count(*) FROM book | CREATE TABLE book (Id VARCHAR) | 有多少本书? |
SELECT Writer FROM book ORDER BY Writer ASC | CREATE TABLE book (Writer VARCHAR) | 按字母顺序列出书的作者。 |
SELECT Title FROM book ORDER BY Issues ASC | CREATE TABLE book (Issues VARCHAR, Title VARCHAR) | 按出版升序排列,列出书名。 |
SELECT Title FROM book WHERE Writer != "钱钟书" | CREATE TABLE book (Writer VARCHAR, Title VARCHAR) | 作者不是“钱钟书”的书名是什么? |
SELECT Title , Issues FROM book | CREATE TABLE book (Issues VARCHAR, Title VARCHAR) | 书的题目和出版是什么? |
SELECT Publication_Date FROM publication ORDER BY Price DESC | CREATE TABLE publication (Price VARCHAR, Publication_Date VARCHAR) | 按价格降序排列的出版物日期是什么? |
SELECT DISTINCT Publisher FROM publication WHERE Price > 5000000 | CREATE TABLE publication (Publisher VARCHAR, Price INTEGER) | 哪些不同出版商有格高于5000000的出版物? |
SELECT Publisher FROM publication ORDER BY Price DESC LIMIT 1 | CREATE TABLE publication (Publisher VARCHAR, Price VARCHAR) | 列出出版物价格最高的出版商。 |
SELECT Publication_Date FROM publication ORDER BY Price ASC LIMIT 3 | CREATE TABLE publication (Price VARCHAR, Publication_Date VARCHAR) | 列出3个最低价格的出版物的出版日期。 |
SELECT T1.Title , T2.Publication_Date FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID | CREATE TABLE book (Book_ID VARCHAR, Title VARCHAR), CREATE TABLE publication (Book_ID VARCHAR, Publication_Date VARCHAR) | 显示图书的书名和出版日期。 |
SELECT T1.Writer FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID WHERE T2.Price > 4000000 | CREATE TABLE book (Book_ID VARCHAR, Writer VARCHAR), CREATE TABLE publication (Book_ID VARCHAR, Price INTEGER) | 显示已经出版的一本价格超过4000000的书的作家。 |
SELECT T1.Title FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID ORDER BY T2.Price DESC | CREATE TABLE book (Book_ID VARCHAR, Title VARCHAR), CREATE TABLE publication (Book_ID VARCHAR, Price VARCHAR) | 按出版物价格的顺序显示书名。 |
SELECT Publisher FROM publication GROUP BY Publisher HAVING COUNT(*) > 1 | CREATE TABLE publication (Publisher VARCHAR) | 显示有不止一个出版物的出版商。 |
SELECT Publisher , COUNT(*) FROM publication GROUP BY Publisher | CREATE TABLE publication (Publisher VARCHAR) | 展示不同的出版商以及他们出版的出版物数量。 |
SELECT Publication_Date FROM publication GROUP BY Publication_Date ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE publication (Publication_Date VARCHAR) | 请显示最常见的出版日期。 |
SELECT Writer FROM book GROUP BY Writer HAVING COUNT(*) > 1 | CREATE TABLE book (Writer VARCHAR) | 列出那些写过不止一本书的作家。 |
SELECT Title FROM book WHERE Book_ID NOT IN (SELECT Book_ID FROM publication) | CREATE TABLE book (Book_ID VARCHAR, Title VARCHAR), CREATE TABLE publication (Book_ID VARCHAR, Title VARCHAR) | 列出未出版的书名。 |
SELECT Publisher FROM publication WHERE Price > 10000000 INTERSECT SELECT Publisher FROM publication WHERE Price < 5000000 | CREATE TABLE publication (Publisher VARCHAR, Price INTEGER) | 显示价格高于10000000和价格低于50000000的出版物的出版商。 |
SELECT COUNT (DISTINCT Publication_Date) FROM publication | CREATE TABLE publication (Publication_Date VARCHAR) | 不同出版日期的出版物数量是多少? |
SELECT COUNT (DISTINCT Publication_Date) FROM publication | CREATE TABLE publication (Publication_Date VARCHAR) | 我们的记录中有多少种不同的出版日期? |
SELECT Price FROM publication WHERE Publisher = "文学" OR Publisher = "机械" | CREATE TABLE publication (Publisher VARCHAR, Price VARCHAR) | 显示出版商是“文学”或“机械”的出版物价格。 |
SELECT count(*) FROM actor | CREATE TABLE actor (Id VARCHAR) | 那儿有多少演员? |
SELECT count(*) FROM actor | CREATE TABLE actor (Id VARCHAR) | 统计演员的数量。 |
SELECT Name FROM actor ORDER BY Name ASC | CREATE TABLE actor (Name VARCHAR) | 按照升序字母顺序列出演员的名字。 |
SELECT Name FROM actor ORDER BY Name ASC | CREATE TABLE actor (Name VARCHAR) | 演员的名字是什么,按字母顺序排列? |
SELECT Character , Duration FROM actor | CREATE TABLE actor (Duration VARCHAR, Character VARCHAR) | 演员的角色和持续时间是什么? |
SELECT Character , Duration FROM actor | CREATE TABLE actor (Duration VARCHAR, Character VARCHAR) | 返回每个演员的角色和持续时间。 |
SELECT Name FROM actor WHERE Age != 20 | CREATE TABLE actor (Name VARCHAR, Age VARCHAR) | 列出年龄不是20岁的演员的名字。 |
SELECT Name FROM actor WHERE Age != 20 | CREATE TABLE actor (Name VARCHAR, Age VARCHAR) | 不是20岁的演员的名字是什么? |
SELECT Character FROM actor ORDER BY age DESC | CREATE TABLE actor (age VARCHAR, Character VARCHAR) | 按照年龄降序,演员的角色是什么? |
SELECT Character FROM actor ORDER BY age DESC | CREATE TABLE actor (age VARCHAR, Character VARCHAR) | 返回演员的角色,按年龄降序排序。 |
SELECT Duration FROM actor ORDER BY Age DESC LIMIT 1 | CREATE TABLE actor (Duration VARCHAR, Age VARCHAR) | 最老演员的持续时间是多少? |
SELECT Duration FROM actor ORDER BY Age DESC LIMIT 1 | CREATE TABLE actor (Duration VARCHAR, Age VARCHAR) | 返回最大年龄的演员的持续时间。 |
SELECT Name FROM musical WHERE Nominee = "梁朝伟" | CREATE TABLE musical (Name VARCHAR, Nominee VARCHAR) | 提名“梁朝伟”的音乐剧名称是什么? |
SELECT Name FROM musical WHERE Nominee = "梁朝伟" | CREATE TABLE musical (Name VARCHAR, Nominee VARCHAR) | 返回有提名“梁朝伟”的音乐剧名称。 |
SELECT DISTINCT Nominee FROM musical WHERE Award != "金鸡奖" | CREATE TABLE musical (Award VARCHAR, Nominee VARCHAR) | 除了“金鸡奖”之外,还有哪些音乐剧的不同提名呢? |
SELECT DISTINCT Nominee FROM musical WHERE Award != "金鸡奖" | CREATE TABLE musical (Award VARCHAR, Nominee VARCHAR) | 返回奖项不是“金鸡奖”的音乐剧的不同提名。 |
SELECT T1.Name , T2.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID | CREATE TABLE actor (Name VARCHAR, Musical_ID VARCHAR), CREATE TABLE musical (Name VARCHAR, Musical_ID VARCHAR) | 显示演员姓名和音乐剧名称。 |
SELECT T1.Name , T2.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID | CREATE TABLE actor (Name VARCHAR, Musical_ID VARCHAR), CREATE TABLE musical (Name VARCHAR, Musical_ID VARCHAR) | 演员和他们出演的音乐剧的名字是什么? |
SELECT T1.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID WHERE T2.Name = "歌剧魅影" | CREATE TABLE actor (Name VARCHAR, Musical_ID VARCHAR), CREATE TABLE musical (Name VARCHAR, Musical_ID VARCHAR) | 显示以“歌剧魅影”为名字的音乐剧中的演员的名字。 |
SELECT T1.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID WHERE T2.Name = "歌剧魅影" | CREATE TABLE actor (Name VARCHAR, Musical_ID VARCHAR), CREATE TABLE musical (Name VARCHAR, Musical_ID VARCHAR) | 音乐剧“歌剧魅影”的演员叫什么名字? |
SELECT T1.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID ORDER BY T2.Year DESC | CREATE TABLE actor (Name VARCHAR, Musical_ID VARCHAR), CREATE TABLE musical (Year VARCHAR, Musical_ID VARCHAR) | 以出演的音乐剧获奖的年份降序排列,显示演员姓名。 |
SELECT T1.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID ORDER BY T2.Year DESC | CREATE TABLE actor (Name VARCHAR, Musical_ID VARCHAR), CREATE TABLE musical (Year VARCHAR, Musical_ID VARCHAR) | 按出演的音乐剧获奖年份降序排列,演员姓名是什么? |
SELECT T2.Name , COUNT(*) FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID GROUP BY T1.Musical_ID | CREATE TABLE actor (Musical_ID VARCHAR), CREATE TABLE musical (Name VARCHAR, Musical_ID VARCHAR) | 显示音乐剧的名称和在音乐剧中出现的演员的数目。 |
SELECT T2.Name , COUNT(*) FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID GROUP BY T1.Musical_ID | CREATE TABLE actor (Musical_ID VARCHAR), CREATE TABLE musical (Name VARCHAR, Musical_ID VARCHAR) | 每个音乐剧中有多少演员? |
SELECT T2.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID GROUP BY T1.Musical_ID HAVING COUNT(*) >= 3 | CREATE TABLE actor (Musical_ID VARCHAR), CREATE TABLE musical (Name VARCHAR, Musical_ID VARCHAR) | 显示至少有三个演员的音乐剧名称。 |
SELECT T2.Name FROM actor AS T1 JOIN musical AS T2 ON T1.Musical_ID = T2.Musical_ID GROUP BY T1.Musical_ID HAVING COUNT(*) >= 3 | CREATE TABLE actor (Musical_ID VARCHAR), CREATE TABLE musical (Name VARCHAR, Musical_ID VARCHAR) | 有3个或更多演员的音乐剧名称是什么? |
SELECT Nominee , COUNT(*) FROM musical GROUP BY Nominee | CREATE TABLE musical (Nominee VARCHAR) | 显示不同的被提名者和他们提名的音乐剧的数量。 |
SELECT Nominee , COUNT(*) FROM musical GROUP BY Nominee | CREATE TABLE musical (Nominee VARCHAR) | 每个被提名者有多少音乐剧被提名? |
SELECT Nominee FROM musical GROUP BY Nominee ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE musical (Nominee VARCHAR) | 请显示被提名次数最多的被提名者。 |
SELECT Nominee FROM musical GROUP BY Nominee ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE musical (Nominee VARCHAR) | 谁是被提名音乐剧最多的的被提名人? |
SELECT RESULT FROM musical GROUP BY RESULT ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE musical (RESULT VARCHAR) | 列出音乐剧最常见的结局。 |
SELECT RESULT FROM musical GROUP BY RESULT ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE musical (RESULT VARCHAR) | 返回所有音乐剧中最常见的结局。 |
SELECT Nominee FROM musical GROUP BY Nominee HAVING COUNT(*) > 2 | CREATE TABLE musical (Nominee VARCHAR) | 列出被提名超过两部音乐剧的被提名者。 |
SELECT Nominee FROM musical GROUP BY Nominee HAVING COUNT(*) > 2 | CREATE TABLE musical (Nominee VARCHAR) | 被提名超过两次的被提名者是谁? |
SELECT Name FROM musical WHERE Musical_ID NOT IN (SELECT Musical_ID FROM actor) | CREATE TABLE musical (Name VARCHAR, Musical_ID VARCHAR), CREATE TABLE actor (Name VARCHAR, Musical_ID VARCHAR) | 列出没有演员的音乐剧名称。 |
SELECT Name FROM musical WHERE Musical_ID NOT IN (SELECT Musical_ID FROM actor) | CREATE TABLE musical (Name VARCHAR, Musical_ID VARCHAR), CREATE TABLE actor (Name VARCHAR, Musical_ID VARCHAR) | 没有演员的音乐剧名称是什么? |
SELECT Nominee FROM musical WHERE Award = "金鸡奖" INTERSECT SELECT Nominee FROM musical WHERE Award = "金马奖" | CREATE TABLE musical (Award VARCHAR, Nominee VARCHAR) | 显示被提名“金鸡奖”和“金马奖”的被提名人。 |
SELECT Nominee FROM musical WHERE Award = "金鸡奖" INTERSECT SELECT Nominee FROM musical WHERE Award = "金马奖" | CREATE TABLE musical (Award VARCHAR, Nominee VARCHAR) | 谁被提名过“金鸡奖”和“金马奖”? |
SELECT Nominee FROM musical WHERE Award = "金鸡奖" OR Award = "金像奖" | CREATE TABLE musical (Award VARCHAR, Nominee VARCHAR) | 显示获得“金鸡奖”或“金像奖”奖的被提名音乐人。 |
SELECT Nominee FROM musical WHERE Award = "金鸡奖" OR Award = "金像奖" | CREATE TABLE musical (Award VARCHAR, Nominee VARCHAR) | 谁被提名过“金鸡奖”或“金像奖”奖项? |
SELECT email FROM user_profiles WHERE name = '马丽' | CREATE TABLE user_profiles (name VARCHAR, email VARCHAR) | 找到名为“马丽”的用户的电子邮件。 |
SELECT partitionid FROM user_profiles WHERE name = '钢铁侠' | CREATE TABLE user_profiles (name VARCHAR, partitionid VARCHAR) | 名为“钢铁侠”的用户的ID是什么? |
SELECT count(*) FROM user_profiles | CREATE TABLE user_profiles (Id VARCHAR) | 有多少用户? |
SELECT count(*) FROM follows | CREATE TABLE follows (Id VARCHAR) | 每个用户有多少追随者? |
SELECT count(*) FROM follows GROUP BY f1 | CREATE TABLE follows (f1 VARCHAR) | 查找每个用户的追随者数量。 |
SELECT count(*) FROM tweets | CREATE TABLE tweets (Id VARCHAR) | 在记录中找到推文的数量。 |
SELECT count(DISTINCT UID) FROM tweets | CREATE TABLE tweets (UID VARCHAR) | 查找发布了的推文的用户的数量。 |
SELECT name , email FROM user_profiles WHERE name LIKE '往事随风' | CREATE TABLE user_profiles (name VARCHAR, email VARCHAR) | 找出用户名字中含有“往事随风”的人的名字和电子邮箱。 |
SELECT name FROM user_profiles WHERE email LIKE '巨星' OR email LIKE 'qq' | CREATE TABLE user_profiles (name VARCHAR, email VARCHAR) | 找出电子邮箱中中含有“superstar”或是“edu”的用户的名字。 |
SELECT text FROM tweets WHERE text LIKE '实习' | CREATE TABLE tweets (text VARCHAR) | 返回关于“实习”主题的推文。 |
SELECT name , email FROM user_profiles WHERE followers > 1000 | CREATE TABLE user_profiles (name VARCHAR, email VARCHAR, followers INTEGER) | 查找拥有超过1000个追随者的用户的姓名和电子邮件。 |
SELECT T1.name FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f1 GROUP BY T2.f1 HAVING count(*) > (SELECT count(*) FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f1 WHERE T1.name = '蔡依林') | CREATE TABLE user_profiles (uid VARCHAR, name VARCHAR), CREATE TABLE follows (f1 VARCHAR) | 查找追随者数量大于名为“蔡依林”的用户的用户名称。 |
SELECT T1.name , T1.email FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f1 GROUP BY T2.f1 HAVING count(*) > 1 | CREATE TABLE user_profiles (uid VARCHAR, name VARCHAR, email VARCHAR), CREATE TABLE follows (f1 VARCHAR) | 查找有不止一个跟随者的用户的姓名和电子邮件。 |
SELECT T1.name FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid HAVING count(*) > 1 | CREATE TABLE user_profiles (uid VARCHAR, name VARCHAR), CREATE TABLE tweets (uid VARCHAR) | 查找拥有不止一条推特的用户的姓名。 |
SELECT T2.f1 FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f2 WHERE T1.name = "马丽" INTERSECT SELECT T2.f1 FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f2 WHERE T1.name = "苏晴" | CREATE TABLE user_profiles (uid VARCHAR, name VARCHAR), CREATE TABLE follows (f1 VARCHAR, f2 VARCHAR) | 找到被“马丽”和“苏晴”跟随的用户的ID。 |
SELECT T2.f1 FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f2 WHERE T1.name = "马丽" OR T1.name = "苏晴" | CREATE TABLE user_profiles (uid VARCHAR, name VARCHAR), CREATE TABLE follows (f1 VARCHAR, f2 VARCHAR) | 找到“马丽”或“苏晴”共同追随的用户的ID。 |
SELECT name FROM user_profiles ORDER BY followers DESC LIMIT 1 | CREATE TABLE user_profiles (name VARCHAR, followers VARCHAR) | 查找有最多追随者的用户的名称。 |
SELECT name , email FROM user_profiles ORDER BY followers LIMIT 1 | CREATE TABLE user_profiles (followers VARCHAR, name VARCHAR, email VARCHAR) | 找到有最少追随者的用户的名字和电子邮件。 |
SELECT name , followers FROM user_profiles ORDER BY followers DESC | CREATE TABLE user_profiles (name VARCHAR, followers VARCHAR) | 按跟随者数量的降序进行排序,列出每个用户的名称和追随者数目。 |
SELECT name FROM user_profiles ORDER BY followers DESC LIMIT 5 | CREATE TABLE user_profiles (name VARCHAR, followers VARCHAR) | 列出拥有追随者的最多的前5个用户的名字。 |
SELECT text FROM tweets ORDER BY createdate | CREATE TABLE tweets (text VARCHAR, createdate VARCHAR) | 按日期顺序列出所有推文的文本。 |
SELECT T1.name , count(*) FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid | CREATE TABLE user_profiles (uid VARCHAR, name VARCHAR), CREATE TABLE tweets (uid VARCHAR) | 找出每个用户的名字和推特的数量。 |
SELECT T1.name , T1.partitionid FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid HAVING count(*) < 2 | CREATE TABLE user_profiles (uid VARCHAR, name VARCHAR, partitionid VARCHAR), CREATE TABLE tweets (uid VARCHAR) | 查找发了不到两次推特的用户的名称和ID。 |
SELECT T1.name , count(*) FROM user_profiles AS T1 JOIN tweets AS T2 ON T1.uid = T2.uid GROUP BY T2.uid HAVING count(*) > 1 | CREATE TABLE user_profiles (uid VARCHAR, name VARCHAR), CREATE TABLE tweets (uid VARCHAR) | 查找不止一次发推特的用户的姓名,以及他们发推特的次数。 |
SELECT avg(followers) FROM user_profiles WHERE UID NOT IN (SELECT UID FROM tweets) | CREATE TABLE user_profiles (followers INTEGER, UID VARCHAR), CREATE TABLE tweets (followers INTEGER, UID VARCHAR) | 查找没有任何推特的用户的平均追随者数量。 |
SELECT avg(followers) FROM user_profiles WHERE UID IN (SELECT UID FROM tweets) | CREATE TABLE user_profiles (followers INTEGER, UID VARCHAR), CREATE TABLE tweets (followers INTEGER, UID VARCHAR) | 查找有一些推文的用户的平均追随者数量。 |