Skip to main content

Section 21.17 Write Code Questions

Checkpoint 21.17.1.

Given a database of bike share information fix the SELECT statement to retrieve the bike_number and duration from table trip_data for bike_number “W00837”.

Checkpoint 21.17.2.

Given a database of bike share information write a SELECT statement below that retrieves the bike_number and duration from table trip_data for all of the rentals that had a duration of more than 85,000.

Checkpoint 21.17.3.

Given a database of bike share information write a SELECT statement below that retrieves the bike_number, duration, and start_date from table trip_data for all of the rentals from start_station 31105 and limit the results to 5.

Checkpoint 21.17.4.

Given a database of bike share information write a SELECT statement below that retrieves the bike_number and member_type for all of the rentals from table trip_data where end_station 31200 and limit the results to 5.

Checkpoint 21.17.5.

Given a database of bike share information write a SELECT statement below that retrieves the bike_number and duration from table trip_data for all of the rentals that had a duration of more than 85,000 and order them by duration descending.

Checkpoint 21.17.6.

Given a database of bike share information write a SELECT statement to retrieve all the rows from tables trip_data and bikeshare_stations where the start_station in trip_data is the same as the station_id in bikeshare_stations. Limit the results to 5 rows.

Checkpoint 21.17.7.

Given a database of bike share information write a SELECT statement to retrieve the duration and bike_number from trip_data and the name from bikeshare_stations where the start_station in trip_data is the same as the station_id in bikeshare_stations. Limit the results to 5 rows.

Checkpoint 21.17.8.

Given a database of bike share information write a SELECT statement to retrieve the duration and bike_number from trip_data and the name, latitude, and longitude from bikeshare_stations where the start_station in trip_data is the same as the station_id in bikeshare_stations. Limit the results to 5 rows.

Checkpoint 21.17.9.

Given a database of bike share information write a SELECT statement to retrieve the bike_number, start_date, and end_date from trip_data and the station_id and name from bikeshare_stations where the start_station in trip_data is the same as the station_id in bikeshare_stations and where the station_id equals 31101. Limit the results to 5 rows.

Checkpoint 21.17.10.

Given a database of bike share information write a SELECT statement to retrieve the bike_number, start_date, and end_date from trip_data and the station_id and name from bikeshare_stations where the start_station in trip_data is the same as the station_id in bikeshare_stations and where the member_type equals “Casual”. Limit the results to 5 rows.