Database: bike_1

Question: What are the dates that had the top 5 cloud cover rates? Also tell me the cloud cover rate.
SQL: SELECT date ,  cloud_cover FROM weather ORDER BY cloud_cover DESC LIMIT 5

Question: What are the ids and durations of the trips with the top 3 durations?
SQL: SELECT id ,  duration FROM trip ORDER BY duration DESC LIMIT 3

Question: For each station, return its longitude and the average duration of trips that started from the station.
SQL: 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

Question: For each station, find its latitude and the minimum duration of trips that ended at the station.
SQL: 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

Question: Find all the zip codes in which the max dew point have never reached 70.
SQL: SELECT DISTINCT zip_code FROM weather EXCEPT SELECT DISTINCT zip_code FROM weather WHERE max_dew_point_f  >=  70

Question: Find the id for the trips that lasted at least as long as the average duration of trips in zip code 94103.
SQL: SELECT id FROM trip WHERE duration  >=  (SELECT avg(duration) FROM trip WHERE zip_code  =  94103)

Question: Find the day in which the difference between the max temperature and min temperature was the smallest. Also report the difference.
SQL: SELECT date ,  max_temperature_f - min_temperature_f FROM weather ORDER BY max_temperature_f - min_temperature_f LIMIT 1

Question: What are the id and name of the stations that have ever had more than 12 bikes available?
SQL: 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

Question: Give me the zip code where the average mean humidity is below 70 and at least 100 trips took place.
SQL: 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

Question: What are the names of stations that are located in Palo Alto city but have never been the ending point of trips more than 100 times?
SQL: SELECT name FROM station WHERE city  =  "Palo Alto" EXCEPT SELECT end_station_name FROM trip GROUP BY end_station_name HAVING count(*)  >  100

Question: How many trips started from Mountain View city and ended at Palo Alto city?
SQL: 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  =  "Mountain View" AND T3.city  =  "Palo Alto"