Complete by February 04, 2026
To complete this assigment you will need to do the following:
- Fork this repository to your own account.
- Clone your fork to your local machine.
- Complete the assignment according to the instructions below.
- Push your changes to your fork.
- Submit a pull request to the original repository. Opening your pull request will be equivalent to you submitting your assignment. You will only need to open one pull request for this assignment. If you make additional changes to your fork, they will automatically show up in the pull request you already opened. Your pull request should have your name in the title (e.g.
Assignment 01 - Mjumbe Poe).
- Indego Bikeshare station status data
- Indego Trip data
- Q3 2021
- Q3 2022
All data is available from Indego's Data site.
For any questions that refer to Meyerson Hall, use latitude 39.952415 and longitude -75.192584 as the coordinates for the building.
Load all three datasets into a PostgreSQL database schema named indego (the name of your database is not important). Your schema should have the following structure:
This structure is important -- particularly the table names and the lowercase field names; if your queries are not built to work with this structure then your assignment will fail the tests.
-
Table:
indego.trips_2021_q3
Fields:trip_id TEXTduration INTEGERstart_time TIMESTAMPend_time TIMESTAMPstart_station TEXTstart_lat FLOATstart_lon FLOATend_station TEXTend_lat FLOATend_lon FLOATbike_id TEXTplan_duration INTEGERtrip_route_category TEXTpassholder_type TEXTbike_type TEXT
-
Table:
indego.trips_2022_q3
Fields: (same as above) -
Table:
indego.station_statuses
Fields (at a minimum -- there may be many more):id INTEGERname TEXT(orCHARACTER VARYING)geog GEOGRAPHY- ...
Write a query to answer each of the questions below.
- Your queries should produce results in the format specified.
- Write your query in a SQL file corresponding to the question number (e.g. a file named query06.sql for the answer to question #6).
- Each SQL file should contain a single
SELECTquery. - Any SQL that does things other than retrieve data (e.g. SQL that creates indexes or update columns) should be in the db_structure.sql file.
- Some questions include a request for you to discuss your methods. Update this README file with your answers in the appropriate place.
-
How many bike trips in Q3 2021?
This file is filled out for you, as an example.
select count(*) from indego.trips_2021_q3
Result: 300,432
-
What is the percent change in trips in Q3 2022 as compared to Q3 2021?
-
What is the longest duration trip across the two quarters?
Why are there so many trips of this duration?
Answer:
-
How many trips in each quarter were shorter than 10 minutes?
-
How many trips started on one day and ended on a different day?
-
Give the five most popular starting stations across all years between 7am and 9:59am.
Hint: Use the
EXTRACTfunction to get the hour of the day from the timestamp. -
List all the passholder types and number of trips for each across all years.
-
Using the station status dataset, find the distance in meters of each station from Meyerson Hall.
-
What is the average distance (in meters) of all stations from Meyerson Hall?