-
This repository contains a set of SQL queries designed to analyze a dataset of taxi trips from the year 2017. These queries are intended to help you gain insights into various aspects of the taxi trips, including fare amounts, trip distances, passenger counts, pickup locations, and more. Overview
-
The dataset, named taxi_trips_2017, contains information about taxi trips that occurred in the year 2017. The dataset includes details such as pickup and drop-off times, trip duration, fare amounts, tip amounts, passenger counts, and pickup locations.
-
The provided SQL queries are designed to answer specific questions about the dataset and extract meaningful insights from it. Each query is accompanied by explanatory comments to help you understand its purpose and functionality.
- Calculate Average Fare Amount: This query calculates the average fare amount for all taxi trips in the dataset.
- Calculate Total Trip Distance: This query calculates the total trip distance covered by all taxi trips.
- Identify Longest and Shortest Trips: Find the longest and shortest trip durations among all the taxi trips.
- Check Store and Forward Flags: Count the number of trips where the store and forward flag is set to true.
- Calculate Total Tip Amount and Average Tip Percentage: This query calculates the total tip amount and the average tip percentage for all trips where fare amount is greater than zero.
- Passenger Count per Hour: Calculate the number of trips made during each hour of the day and present the results in descending order.
- Average Tip Percentage by Payment Type: Calculate the average tip percentage for different payment types, considering only trips with positive fare amounts.
- Common Payment Type: Find the most common payment types used for taxi trips, excluding trips with zero or negative fare amounts.
- Common Trip Type Count: Determine the most common trip types based on fare amounts greater than zero.
- Trip Count by Month: Calculate the number of trips made in each month of the year and present the results in descending order.
- Passenger Count Analysis: Explore the distribution of trips across different passenger counts.
- Average Fare Analysis: Calculate the average fare for trips with varying passenger counts.
- Best and Worst Pickup Locations: Identify the top 10 and bottom 10 pickup locations based on the frequency of trips.