context
stringlengths
28
393
answer
stringlengths
17
532
question
stringlengths
5
112
CREATE TABLE student_course_registrations (student_id VARCHAR), CREATE TABLE student_course_attendance (student_id VARCHAR)
SELECT student_id FROM student_course_registrations UNION SELECT student_id FROM student_course_attendance
注册或参加课程的学生的ID是什么?
CREATE TABLE student_course_registrations (course_id VARCHAR, student_id VARCHAR), CREATE TABLE student_course_attendance (course_id VARCHAR, student_id VARCHAR)
SELECT course_id FROM student_course_registrations WHERE student_id = 121 UNION SELECT course_id FROM student_course_attendance WHERE student_id = 121
查找ID为121的学生注册或参加的课程的ID?
CREATE TABLE student_course_registrations (course_id VARCHAR, student_id VARCHAR), CREATE TABLE student_course_attendance (course_id VARCHAR, student_id VARCHAR)
SELECT course_id FROM student_course_registrations WHERE student_id = 121 UNION SELECT course_id FROM student_course_attendance WHERE student_id = 121
ID是121的学生所注册或参加的课程的ID是什么?
CREATE TABLE student_course_registrations (student_id VARCHAR), CREATE TABLE student_course_attendance (student_id VARCHAR)
SELECT * FROM student_course_registrations WHERE NOT student_id IN (SELECT student_id FROM student_course_attendance)
注册课程但不参加课程的学生都有哪些信息?
CREATE TABLE student_course_registrations (student_id VARCHAR), CREATE TABLE student_course_attendance (student_id VARCHAR)
SELECT * FROM student_course_registrations WHERE NOT student_id IN (SELECT student_id FROM student_course_attendance)
注册但没有参加任何课程的学生的详细情况是什么?
CREATE TABLE courses (course_name VARCHAR, course_id VARCHAR), CREATE TABLE student_course_registrations (course_id VARCHAR, student_id VARCHAR, registration_date VARCHAR)
SELECT T2.student_id FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "统计学" ORDER BY T2.registration_date
按照注册日期的顺序列出注册“统计学”课程的学生的ID。
CREATE TABLE courses (course_name VARCHAR, course_id VARCHAR), CREATE TABLE student_course_registrations (course_id VARCHAR, student_id VARCHAR, registration_date VARCHAR)
SELECT T2.student_id FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "统计学" ORDER BY T2.registration_date
按注册日期顺序排序,注册“统计学”课程的学生的ID是什么?
CREATE TABLE courses (course_name VARCHAR, course_id VARCHAR), CREATE TABLE student_course_attendance (date_of_attendance VARCHAR, course_id VARCHAR, student_id VARCHAR)
SELECT T2.student_id FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "统计学" ORDER BY T2.date_of_attendance
按照出勤日期的顺序列出参加“统计学”课程的学生的ID。
CREATE TABLE courses (course_name VARCHAR, course_id VARCHAR), CREATE TABLE student_course_attendance (date_of_attendance VARCHAR, course_id VARCHAR, student_id VARCHAR)
SELECT T2.student_id FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "统计学" ORDER BY T2.date_of_attendance
按照出勤日期的顺序,上“统计学”学院课程的学生的ID是什么?
CREATE TABLE weather (max_temperature_f INTEGER, date VARCHAR)
SELECT date FROM weather WHERE max_temperature_f > 85
给我最高温度高于85的日期。
CREATE TABLE weather (max_temperature_f INTEGER, date VARCHAR)
SELECT date FROM weather WHERE max_temperature_f > 85
最高温度高于85的日期是什么?
CREATE TABLE station (name VARCHAR, lat INTEGER)
SELECT name FROM station WHERE lat < 37.5
纬度低于37.5的车站名称是什么?
CREATE TABLE station (name VARCHAR, lat INTEGER)
SELECT name FROM station WHERE lat < 37.5
纬度小于37.5的所有车站的名称是什么?
CREATE TABLE station (lat INTEGER, city VARCHAR)
SELECT city, MAX(lat) FROM station GROUP BY city
对于每一个城市,返回所有车站的最高纬度。
CREATE TABLE station (lat INTEGER, city VARCHAR)
SELECT city, MAX(lat) FROM station GROUP BY city
对于每一个城市来说,其车站的最高纬度是什么?
CREATE TABLE trip (end_station_name VARCHAR, start_station_name VARCHAR, id VARCHAR)
SELECT start_station_name, end_station_name FROM trip ORDER BY id LIMIT 3
给我三个ID最老的路线的起始站和结束站。
CREATE TABLE trip (end_station_name VARCHAR, start_station_name VARCHAR, id VARCHAR)
SELECT start_station_name, end_station_name FROM trip ORDER BY id LIMIT 3
三个最小ID的路线的起始站和终点站是什么?
CREATE TABLE station (lat INTEGER, long INTEGER, city VARCHAR)
SELECT AVG(lat), AVG(long) FROM station WHERE city = "长沙"
“长沙”市车站平均纬度和经度是多少?
CREATE TABLE station (lat INTEGER, long INTEGER, city VARCHAR)
SELECT AVG(lat), AVG(long) FROM station WHERE city = "长沙"
“长沙”市的平均纬度和经度是多少?
CREATE TABLE trip (duration VARCHAR, id VARCHAR)
SELECT id FROM trip ORDER BY duration LIMIT 1
长度最短的路线的ID是什么?
CREATE TABLE trip (duration VARCHAR, id VARCHAR)
SELECT id FROM trip ORDER BY duration LIMIT 1
最短路线的ID是什么?
CREATE TABLE trip (duration INTEGER, bike_id VARCHAR)
SELECT SUM(duration), MAX(duration) FROM trip WHERE bike_id = 636
ID为636的自行车的路线的总时间和最大持续时间是多少?
CREATE TABLE trip (duration INTEGER, bike_id VARCHAR)
SELECT SUM(duration), MAX(duration) FROM trip WHERE bike_id = 636
ID为636自行车的所有路线的总时间和最大持续时间是多少?
CREATE TABLE weather (zip_code VARCHAR, mean_temperature_f INTEGER, date VARCHAR)
SELECT zip_code, AVG(mean_temperature_f) FROM weather WHERE date LIKE "八月" GROUP BY zip_code
对于每个邮编,返回那里8月的平均温度。
CREATE TABLE weather (zip_code VARCHAR, mean_temperature_f INTEGER, date VARCHAR)
SELECT zip_code, AVG(mean_temperature_f) FROM weather WHERE date LIKE "八月" GROUP BY zip_code
对于每个邮政编码,以“8”开头的所有日期的平均温度是多少?
CREATE TABLE trip (bike_id VARCHAR)
SELECT COUNT(DISTINCT bike_id) FROM trip
从路线记录,找出不同的自行车的数量。
CREATE TABLE trip (bike_id VARCHAR)
SELECT COUNT(DISTINCT bike_id) FROM trip
有多少个不同的自行车ID?
CREATE TABLE station (city VARCHAR)
SELECT COUNT(DISTINCT city) FROM station
车站所处的不同城市的数量是多少?
CREATE TABLE station (city VARCHAR)
SELECT COUNT(DISTINCT city) FROM station
这些车站在多少个不同的城市?
CREATE TABLE station (city VARCHAR)
SELECT COUNT(*) FROM station WHERE city = "重庆"
“重庆”城有多少个车站?
CREATE TABLE station (city VARCHAR)
SELECT COUNT(*) FROM station WHERE city = "重庆"
“重庆”有多少车站?
CREATE TABLE station (name VARCHAR, id VARCHAR), CREATE TABLE status (bikes_available VARCHAR, station_id VARCHAR)
SELECT DISTINCT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available = 7
返回曾经有7辆可用自行车的车站的唯一名称。
CREATE TABLE station (name VARCHAR, id VARCHAR), CREATE TABLE status (bikes_available VARCHAR, station_id VARCHAR)
SELECT DISTINCT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available = 7
每个曾经有7辆可用自行车的车站都有哪些不同的名字?
CREATE TABLE trip (start_date VARCHAR, start_station_id VARCHAR, start_station_name VARCHAR)
SELECT start_station_name, start_station_id FROM trip WHERE start_date LIKE "八月" GROUP BY start_station_name ORDER BY COUNT(*) DESC LIMIT 1
哪一个起点站从8月份开始的路线最多?请告诉我车站的名字和ID。
CREATE TABLE trip (start_date VARCHAR, start_station_id VARCHAR, start_station_name VARCHAR)
SELECT start_station_name, start_station_id FROM trip WHERE start_date LIKE "八月" GROUP BY start_station_name ORDER BY COUNT(*) DESC LIMIT 1
八月份出发次数最多的那个出发站的名称和ID是什么?
CREATE TABLE trip (zip_code VARCHAR, bike_id VARCHAR)
SELECT bike_id FROM trip WHERE zip_code = 94002 GROUP BY bike_id ORDER BY COUNT(*) DESC LIMIT 1
哪辆自行车路线在邮政编码94002的地区旅行最多?
CREATE TABLE trip (zip_code VARCHAR, bike_id VARCHAR)
SELECT bike_id FROM trip WHERE zip_code = 94002 GROUP BY bike_id ORDER BY COUNT(*) DESC LIMIT 1
在邮政编码94002的地区中的旅行最多的自行车的ID是多少?
CREATE TABLE weather (mean_humidity INTEGER, mean_visibility_miles INTEGER)
SELECT COUNT(*) FROM weather WHERE mean_humidity > 50 AND mean_visibility_miles > 8
有多少天平均湿度在50以上,平均能见度在8以上?
CREATE TABLE weather (mean_humidity INTEGER, mean_visibility_miles INTEGER)
SELECT COUNT(*) FROM weather WHERE mean_humidity > 50 AND mean_visibility_miles > 8
平均湿度超过50,平均能见度超过8天的天数是多少?
CREATE TABLE station (city VARCHAR, lat VARCHAR, long VARCHAR, id VARCHAR), CREATE TABLE trip (start_station_id VARCHAR, duration VARCHAR)
SELECT T1.lat, T1.long, T1.city FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id ORDER BY T2.duration LIMIT 1
最短的路线开始的车站是的纬度、经度、城市是什么?
CREATE TABLE station (city VARCHAR, lat VARCHAR, long VARCHAR, id VARCHAR), CREATE TABLE trip (start_station_id VARCHAR, duration VARCHAR)
SELECT T1.lat, T1.long, T1.city FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id ORDER BY T2.duration LIMIT 1
从什么纬度、经度和城市的车站开始的路线最短?
CREATE TABLE station (bikes_available INTEGER, city VARCHAR, station_id VARCHAR, id VARCHAR), CREATE TABLE status (bikes_available INTEGER, city VARCHAR, station_id VARCHAR, id VARCHAR)
SELECT id FROM station WHERE city = "厦门" INTERSECT SELECT station_id FROM status GROUP BY station_id HAVING AVG(bikes_available) > 10
平均自行车可用数在10以上的“厦门”的站台ID是什么?
CREATE TABLE station (bikes_available INTEGER, city VARCHAR, station_id VARCHAR, id VARCHAR), CREATE TABLE status (bikes_available INTEGER, city VARCHAR, station_id VARCHAR, id VARCHAR)
SELECT id FROM station WHERE city = "厦门" INTERSECT SELECT station_id FROM status GROUP BY station_id HAVING AVG(bikes_available) > 10
“厦门”通常有超过10辆可用自行车的车站ID有哪些?
CREATE TABLE station (name VARCHAR, installation_date VARCHAR, id VARCHAR), CREATE TABLE status (bikes_available INTEGER, station_id VARCHAR)
SELECT T1.name, T1.id FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING AVG(T2.bikes_available) > 14 UNION SELECT name, id FROM station WHERE installation_date LIKE "十二月"
平均有14辆以上可用自行车或在12月份安装自行车的车站的名称和ID是什么?
CREATE TABLE station (name VARCHAR, installation_date VARCHAR, id VARCHAR), CREATE TABLE status (bikes_available INTEGER, station_id VARCHAR)
SELECT T1.name, T1.id FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING AVG(T2.bikes_available) > 14 UNION SELECT name, id FROM station WHERE installation_date LIKE "十二月"
平均有14辆以上可用自行车或在12月安装自行车的所有车站的名称和ID是什么?
CREATE TABLE weather (cloud_cover VARCHAR, zip_code VARCHAR)
SELECT cloud_cover FROM weather WHERE zip_code = 94107 GROUP BY cloud_cover ORDER BY COUNT(*) DESC LIMIT 3
在邮政编码94107的地区,3种最常见的云覆盖率是多少?
CREATE TABLE weather (cloud_cover VARCHAR, zip_code VARCHAR)
SELECT cloud_cover FROM weather WHERE zip_code = 94107 GROUP BY cloud_cover ORDER BY COUNT(*) DESC LIMIT 3
94107邮政编码地区中最常见的3种云覆盖是什么?
CREATE TABLE weather (mean_sea_level_pressure_inches INTEGER, zip_code VARCHAR)
SELECT zip_code FROM weather GROUP BY zip_code ORDER BY AVG(mean_sea_level_pressure_inches) LIMIT 1
平均海平面气压最低的地区的邮编是多少?
CREATE TABLE weather (mean_sea_level_pressure_inches INTEGER, zip_code VARCHAR)
SELECT zip_code FROM weather GROUP BY zip_code ORDER BY AVG(mean_sea_level_pressure_inches) LIMIT 1
平均海平面气压最低的地区邮编是什么?
CREATE TABLE status (city VARCHAR, bikes_available INTEGER, station_id VARCHAR, id VARCHAR), CREATE TABLE station (city VARCHAR, bikes_available INTEGER, station_id VARCHAR, id VARCHAR)
SELECT AVG(bikes_available) FROM status WHERE NOT station_id IN (SELECT id FROM station WHERE city = "西安")
不是位于“西安”市的车站里,自行车的平均可用数是多少?
CREATE TABLE status (city VARCHAR, bikes_available INTEGER, station_id VARCHAR, id VARCHAR), CREATE TABLE station (city VARCHAR, bikes_available INTEGER, station_id VARCHAR, id VARCHAR)
SELECT AVG(bikes_available) FROM status WHERE NOT station_id IN (SELECT id FROM station WHERE city = "西安")
不在“西安”市的车站的平均自行车可用率是多少?
CREATE TABLE station (bikes_available INTEGER, long INTEGER, station_id VARCHAR, id VARCHAR), CREATE TABLE status (bikes_available INTEGER, long INTEGER, station_id VARCHAR, id VARCHAR)
SELECT AVG(long) FROM station WHERE NOT id IN (SELECT station_id FROM status GROUP BY station_id HAVING MAX(bikes_available) > 10)
从来没有超过10辆可用自行车的车站的平均经度是多少?
CREATE TABLE station (bikes_available INTEGER, long INTEGER, station_id VARCHAR, id VARCHAR), CREATE TABLE status (bikes_available INTEGER, long INTEGER, station_id VARCHAR, id VARCHAR)
SELECT AVG(long) FROM station WHERE NOT id IN (SELECT station_id FROM status GROUP BY station_id HAVING MAX(bikes_available) > 10)
对于从来没有超过10辆可用自行车的所有车站,它们的平均经度是多少?
CREATE TABLE weather (zip_code VARCHAR, max_temperature_f INTEGER, date VARCHAR)
SELECT date, zip_code FROM weather WHERE max_temperature_f >= 80
什么时候,在什么邮政编码地区最大温度达到80?
CREATE TABLE weather (zip_code VARCHAR, max_temperature_f INTEGER, date VARCHAR)
SELECT date, zip_code FROM weather WHERE max_temperature_f >= 80
什么邮政编码地区有一个最高温度大于或等于80的车站,什么时候达到这个温度?
CREATE TABLE trip (zip_code VARCHAR, id VARCHAR), CREATE TABLE weather (zip_code VARCHAR, mean_temperature_f INTEGER)
SELECT T1.id FROM trip AS T1 JOIN weather AS T2 ON T1.zip_code = T2.zip_code GROUP BY T2.zip_code HAVING AVG(T2.mean_temperature_f) > 60
请给出平均温度高于60度的邮政编码区进行的所有路线的ID。
CREATE TABLE trip (zip_code VARCHAR, id VARCHAR), CREATE TABLE weather (zip_code VARCHAR, mean_temperature_f INTEGER)
SELECT T1.id FROM trip AS T1 JOIN weather AS T2 ON T1.zip_code = T2.zip_code GROUP BY T2.zip_code HAVING AVG(T2.mean_temperature_f) > 60
对于每个邮政编码地区,找到所有具有平均温度在60以上的路线的ID?
CREATE TABLE weather (zip_code VARCHAR, max_wind_Speed_mph INTEGER)
SELECT zip_code, COUNT(*) FROM weather WHERE max_wind_Speed_mph >= 25 GROUP BY zip_code
对于每个邮编地区,返回最大风速达到25的次数?
CREATE TABLE weather (zip_code VARCHAR, max_wind_Speed_mph INTEGER)
SELECT zip_code, COUNT(*) FROM weather WHERE max_wind_Speed_mph >= 25 GROUP BY zip_code
对于每一个邮政编码地区,多少次最大风速达到25英里每小时?
CREATE TABLE weather (min_dew_point_f INTEGER, zip_code VARCHAR, date VARCHAR)
SELECT date, zip_code FROM weather WHERE min_dew_point_f < (SELECT MIN(min_dew_point_f) FROM weather WHERE zip_code = 94107)
哪一天哪个地区的最小露点低于邮编94107地区中任何一天,这些地区的邮编是什么?
CREATE TABLE weather (min_dew_point_f INTEGER, zip_code VARCHAR, date VARCHAR)
SELECT date, zip_code FROM weather WHERE min_dew_point_f < (SELECT MIN(min_dew_point_f) FROM weather WHERE zip_code = 94107)
哪些天的最低露点比邮政编码94107中的任何一天都要小,在哪个邮政编码地区中进行测量的?
CREATE TABLE trip (end_station_id VARCHAR, id VARCHAR), CREATE TABLE station (installation_date VARCHAR, id VARCHAR)
SELECT T1.id, T2.installation_date FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id = T2.id
针对每个路线,返回其终点站的安装日期。
CREATE TABLE trip (end_station_id VARCHAR, id VARCHAR), CREATE TABLE station (installation_date VARCHAR, id VARCHAR)
SELECT T1.id, T2.installation_date FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id = T2.id
每个旅程的终点站的安装日期是多少?
CREATE TABLE trip (start_station_id VARCHAR, id VARCHAR), CREATE TABLE station (dock_count VARCHAR, id VARCHAR)
SELECT T1.id FROM trip AS T1 JOIN station AS T2 ON T1.start_station_id = T2.id ORDER BY T2.dock_count DESC LIMIT 1
哪一次旅行从码头数最多的车站开始?把旅行id给我。
CREATE TABLE trip (start_station_id VARCHAR, id VARCHAR), CREATE TABLE station (dock_count VARCHAR, id VARCHAR)
SELECT T1.id FROM trip AS T1 JOIN station AS T2 ON T1.start_station_id = T2.id ORDER BY T2.dock_count DESC LIMIT 1
从码头数最高的车站出发的旅行ID是什么?
CREATE TABLE trip (end_station_id VARCHAR), CREATE TABLE station (city VARCHAR, id VARCHAR)
SELECT COUNT(*) FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id = T2.id WHERE T2.city <> "厦门"
统计不是结束在“厦门”市的旅行的次数。
CREATE TABLE trip (end_station_id VARCHAR), CREATE TABLE station (city VARCHAR, id VARCHAR)
SELECT COUNT(*) FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id = T2.id WHERE T2.city <> "厦门"
有多少次旅行没有结束在“厦门”?
CREATE TABLE weather (zip_code VARCHAR, EVENTS VARCHAR, date VARCHAR)
SELECT date FROM weather WHERE zip_code = 94107 AND EVENTS <> "大雾" AND EVENTS <> "大雨"
在邮政编码94107,在哪一天既没有“大雨”也没有观察到“大雾”?
CREATE TABLE weather (zip_code VARCHAR, EVENTS VARCHAR, date VARCHAR)
SELECT date FROM weather WHERE zip_code = 94107 AND EVENTS <> "大雾" AND EVENTS <> "大雨"
在94107的邮政编码哪一天既没有“大雨”也没有“大雾”?
CREATE TABLE station (lat INTEGER, bikes_available INTEGER, station_id VARCHAR, id VARCHAR), CREATE TABLE status (lat INTEGER, bikes_available INTEGER, station_id VARCHAR, id VARCHAR)
SELECT id FROM station WHERE lat > 37.4 EXCEPT SELECT station_id FROM status GROUP BY station_id HAVING MIN(bikes_available) < 7
那些纬度在37.4以上、自行车可用率从来在7以下的车站的ID是多少?
CREATE TABLE station (lat INTEGER, bikes_available INTEGER, station_id VARCHAR, id VARCHAR), CREATE TABLE status (lat INTEGER, bikes_available INTEGER, station_id VARCHAR, id VARCHAR)
SELECT id FROM station WHERE lat > 37.4 EXCEPT SELECT station_id FROM status GROUP BY station_id HAVING MIN(bikes_available) < 7
所有纬度在37.4以上、从来没有少于7辆可用自行车的车站的ID是什么?
CREATE TABLE station (name VARCHAR, city VARCHAR, bikes_available INTEGER), CREATE TABLE status (station_id VARCHAR)
SELECT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING AVG(bikes_available) > 10 EXCEPT SELECT name FROM station WHERE city = "长沙"
哪些车站的平均自行车供应量超过10而且不位于'“长沙”‘市?
CREATE TABLE station (name VARCHAR, city VARCHAR, bikes_available INTEGER), CREATE TABLE status (station_id VARCHAR)
SELECT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING AVG(bikes_available) > 10 EXCEPT SELECT name FROM station WHERE city = "长沙"
有超过十辆自行车,而且不在'“长沙”‘的所有车站都叫什么名字?
CREATE TABLE station (name VARCHAR, lat VARCHAR, city VARCHAR)
SELECT name, lat, city FROM station ORDER BY lat LIMIT 1
最低纬度的车站的名称、纬度和城市是什么?
CREATE TABLE station (name VARCHAR, lat VARCHAR, city VARCHAR)
SELECT name, lat, city FROM station ORDER BY lat LIMIT 1
位于最南边的火车站的名称、纬度和城市是什么?
CREATE TABLE weather (max_gust_speed_mph VARCHAR, mean_humidity VARCHAR, mean_temperature_f VARCHAR, date VARCHAR)
SELECT date, mean_temperature_f, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3
最大阵风速度最高的3天的日期、平均温度和平均湿度是多少?
CREATE TABLE weather (max_gust_speed_mph VARCHAR, mean_humidity VARCHAR, mean_temperature_f VARCHAR, date VARCHAR)
SELECT date, mean_temperature_f, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3
三个最大阵风速度的日子的日期、平均温度和平均湿度是多少?
CREATE TABLE station (city VARCHAR)
SELECT city, COUNT(*) FROM station GROUP BY city HAVING COUNT(*) >= 15
列出所有至少有15个站点的城市的名称和站点数量。
CREATE TABLE station (city VARCHAR)
SELECT city, COUNT(*) FROM station GROUP BY city HAVING COUNT(*) >= 15
每个至少有15个车站的城市叫什么名字?有多少个车站?
CREATE TABLE trip (start_station_id VARCHAR, start_station_name VARCHAR)
SELECT start_station_id, start_station_name FROM trip GROUP BY start_station_name HAVING COUNT(*) >= 200
查找至少有200个路线开始的站的ID和名称。
CREATE TABLE trip (start_station_id VARCHAR, start_station_name VARCHAR)
SELECT start_station_id, start_station_name FROM trip GROUP BY start_station_name HAVING COUNT(*) >= 200
至少是200个路线的出发站的车站的ID和名称是什么?
CREATE TABLE weather (zip_code VARCHAR, mean_visibility_miles INTEGER)
SELECT zip_code FROM weather GROUP BY zip_code HAVING AVG(mean_visibility_miles) < 10
找到平均能见度低于10的地区的邮政编码。
CREATE TABLE weather (zip_code VARCHAR, mean_visibility_miles INTEGER)
SELECT zip_code FROM weather GROUP BY zip_code HAVING AVG(mean_visibility_miles) < 10
对于每个邮政编码,选择那些平均可见度低于10的地区的邮政编码。
CREATE TABLE station (lat INTEGER, city VARCHAR)
SELECT city FROM station GROUP BY city ORDER BY MAX(lat) DESC
按照每个城市站点的最高纬度的递减顺序列出所有城市。
CREATE TABLE station (lat INTEGER, city VARCHAR)
SELECT city FROM station GROUP BY city ORDER BY MAX(lat) DESC
对于每个城市,按其最高站点纬度降序排列,列出它们的名称。
CREATE TABLE weather (cloud_cover VARCHAR, date VARCHAR)
SELECT date, cloud_cover FROM weather ORDER BY cloud_cover DESC LIMIT 5
前5的云覆盖率的日期是什么?并告诉我云的覆盖率。
CREATE TABLE weather (cloud_cover VARCHAR, date VARCHAR)
SELECT date, cloud_cover FROM weather ORDER BY cloud_cover DESC LIMIT 5
前5高的云覆盖率的日期是什么,覆盖率是多少?
CREATE TABLE trip (duration VARCHAR, id VARCHAR)
SELECT id, duration FROM trip ORDER BY duration DESC LIMIT 3
前3的持续时间的路线的ID和持续时间是什么?
CREATE TABLE trip (duration VARCHAR, id VARCHAR)
SELECT id, duration FROM trip ORDER BY duration DESC LIMIT 3
持续时间最长的路线ID是什么?路线时间多长?
CREATE TABLE station (name VARCHAR, long VARCHAR, id VARCHAR), CREATE TABLE trip (start_station_id VARCHAR, duration INTEGER)
SELECT T1.name, T1.long, AVG(T2.duration) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id GROUP BY T2.start_station_id
对于每个站点,返回其经度和从该站点开始的路线的平均持续时间。
CREATE TABLE station (name VARCHAR, long VARCHAR, id VARCHAR), CREATE TABLE trip (start_station_id VARCHAR, duration INTEGER)
SELECT T1.name, T1.long, AVG(T2.duration) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id GROUP BY T2.start_station_id
对于每个起始站ID,它的名称、经度和在那里开始的路线的平均持续时间是什么?
CREATE TABLE station (name VARCHAR, lat VARCHAR, id VARCHAR), CREATE TABLE trip (duration INTEGER, end_station_id VARCHAR)
SELECT T1.name, T1.lat, MIN(T2.duration) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.end_station_id GROUP BY T2.end_station_id
对于每个车站,找到它的纬度和在这个车站结束的路线的最小持续时间。
CREATE TABLE station (name VARCHAR, lat VARCHAR, id VARCHAR), CREATE TABLE trip (duration INTEGER, end_station_id VARCHAR)
SELECT T1.name, T1.lat, MIN(T2.duration) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.end_station_id GROUP BY T2.end_station_id
对于每个终点站ID,它的名称、纬度和以此为终点站的路线的最短持续时间是什么?
CREATE TABLE trip (duration INTEGER, start_station_name VARCHAR)
SELECT DISTINCT start_station_name FROM trip WHERE duration < 100
列出所有持续时间低于100的路线的不同起始车站。
CREATE TABLE trip (duration INTEGER, start_station_name VARCHAR)
SELECT DISTINCT start_station_name FROM trip WHERE duration < 100
对于持续时间不到100的路线,不同的起点站名是什么?
CREATE TABLE weather (zip_code VARCHAR, max_dew_point_f INTEGER)
SELECT DISTINCT zip_code FROM weather EXCEPT SELECT DISTINCT zip_code FROM weather WHERE max_dew_point_f >= 70
查找所有最大露点从未达到70的邮政编码。
CREATE TABLE weather (zip_code VARCHAR, max_dew_point_f INTEGER)
SELECT DISTINCT zip_code FROM weather EXCEPT SELECT DISTINCT zip_code FROM weather WHERE max_dew_point_f >= 70
哪些地区的最大露点总是低于70,这些地区的不同邮编是多少?
CREATE TABLE trip (duration INTEGER, zip_code VARCHAR, id VARCHAR)
SELECT id FROM trip WHERE duration >= (SELECT AVG(duration) FROM trip WHERE zip_code = 94103)
在邮政编码94103地区中,查找至少与路线平均持续时间一样长的路线的id。
CREATE TABLE trip (duration INTEGER, zip_code VARCHAR, id VARCHAR)
SELECT id FROM trip WHERE duration >= (SELECT AVG(duration) FROM trip WHERE zip_code = 94103)
邮政编码94103地区中持续时间和平均旅行持续时间一样长的所有路线的id是什么?
CREATE TABLE weather (mean_sea_level_pressure_inches INTEGER, date VARCHAR)
SELECT date FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31
平均海平面气压在30.3到31之间的日期是什么?