pasztora
2/14/2019 - 3:02 PM

More tricky SQL queries

# Following the Dataquest tutorial:
# https://www.dataquest.io/blog/sql-basics/


# Which bike was used for the most trips? The COUNT is carried out after bike_number column was grouped
query = "SELECT bike_number AS 'Bike number', COUNT(*) AS 'Number of trips' FROM trips GROUP BY bike_number ORDER BY COUNT(*) DESC LIMIT 1;"
run_query(query)