Database: bike_1

Question: What is the average longitude of stations that never had bike availability more than 10?
SQL: SELECT avg(long) FROM station WHERE id NOT IN (SELECT station_id FROM status GROUP BY station_id HAVING max(bikes_available)  >  10)

Question: Give me ids for all the trip that took place in a zip code area with average mean temperature above 60.
SQL: 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

Question: For each zip code, return how many times max wind speed reached 25?
SQL: SELECT zip_code , count(*) FROM weather WHERE max_wind_Speed_mph  >=  25 GROUP BY zip_code

Question: On which day and in which zip code was the min dew point lower than any day in zip code 94107?
SQL: SELECT date ,  zip_code FROM weather WHERE min_dew_point_f  <  (SELECT min(min_dew_point_f) FROM weather WHERE zip_code  =  94107)

Question: Which trip started from the station with the largest dock count? Give me the trip id.
SQL: 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

Question: Count the number of trips that did not end in San Francisco city.
SQL: SELECT count(*) FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id  =  T2.id WHERE T2.city !=  "San Francisco"

Question: In zip code 94107, on which day neither Fog nor Rain was observed?
SQL: SELECT date FROM weather WHERE zip_code  =  94107 AND EVENTS != "Fog" AND EVENTS != "Rain"

Question: What are the ids of stations that have latitude above 37.4 and never had bike availability below 7?
SQL: SELECT id FROM station WHERE lat  >  37.4 EXCEPT SELECT station_id FROM status GROUP BY station_id HAVING min(bikes_available)  <  7

Question: What are names of stations that have average bike availability above 10 and are not located in San Jose city?
SQL: 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  =  "San Jose"

Question: What are the name, latitude, and city of the station with the lowest latitude?
SQL: SELECT name ,  lat ,  city FROM station ORDER BY lat LIMIT 1

Question: What are the date, mean temperature and mean humidity for the top 3 days with the largest max gust speeds?
SQL: SELECT date ,  mean_temperature_f ,  mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3

Question: List the name and the number of stations for all the cities that have at least 15 stations.
SQL: SELECT city ,  COUNT(*) FROM station GROUP BY city HAVING COUNT(*)  >=  15

Question: Find the ids and names of stations from which at least 200 trips started.
SQL: SELECT start_station_id ,  start_station_name FROM trip GROUP BY start_station_id HAVING COUNT(*)  >=  200

Question: Find the zip code in which the average mean visibility is lower than 10.
SQL: SELECT zip_code FROM weather GROUP BY zip_code HAVING avg(mean_visibility_miles)  <  10

Question: List all the cities in a decreasing order of each city's stations' highest latitude.
SQL: SELECT city FROM station GROUP BY city ORDER BY max(lat) DESC