Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. Q1:What was the hottest day in our data set? Where was that?
  2. A1: Hottest day had a temperature of 134 degrees in the area code 94063 on Novermeber 11th, 2015.
  3.  
  4. SELECT
  5. zip,
  6. MAX(maxtemperaturef)
  7. FROM
  8. weather
  9. GROUP BY zip
  10.  
  11. SELECT
  12. date,
  13. maxtemperaturef,
  14. zip
  15. FROM
  16. weather
  17. ORDER BY maxtemperaturef DESC
  18.  
  19. Q2: How many trips started at each station?
  20. A2:The top three stations are SF Caltrain on 4th, SF Caltrain on 330 Townsend,
  21. and Ferry Building. With 23,591, 22,358, and 16,128 trips starting from those stations, respectively.
  22.  
  23. SELECT
  24. COUNT(*),
  25. start_station
  26. FROM
  27. trips
  28. GROUP BY start_station
  29. ORDER BY COUNT DESC
  30.  
  31. Q3: What's the shortest trip that happened?
  32. A3: The shortest trip duration was 60 seconds, 14 trips in the data set were 60 seconds long. Originating
  33. from stations, such as the Temp Transbay Terminal, San Jose Diridon Caltrain Station, and Union Square in SF.
  34.  
  35. SELECT
  36. MIN(duration) as duration_second,
  37. start_station
  38. FROM
  39. trips
  40. GROUP BY start_station
  41. ORDER BY duration_second ASC
  42.  
  43. Q4: What is the average trip duration, by end station?
  44.  
  45. SELECT
  46. end_station,
  47. AVG(duration) as avg_duration
  48. FROM
  49. trips
  50. GROUP BY end_station
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement