Build a Taxi Operations SQL Report
Use Databricks SQL to turn taxi trips into a pickup-area operations report.
Introduction
30 Second Summary
Taxi trip data arrives one ride at a time. A transport manager still needs a clear view of which pickup areas drive activity.
In this project, you will build a Taxi Operations SQL Report in Databricks Free Edition. The report reveals the leading qualifying pickup areas through trip activity plus total fare amount.
What You'll Build
The finished notebook shows the leading pickup ZIP codes in a fare summary beside a bar chart.
By the end of this project, you'll have:
- A cleaned trip view where every row has a positive fare, a positive distance, plus a Short, Medium, or Long label.
- A pickup-area report that surfaces the leading qualifying ZIP codes in a table beside a bar visualization.
- A public GitHub portfolio repository that lets recruiters read your SQL plus project explanation without Databricks access.
- Secret Mission: A ranked pickup-area query using a common table expression plus RANK() to assign an explicit revenue rank.
Are there any prerequisites?
You need access to Databricks Free Edition plus a GitHub account. No local installation is required.
Before We Start
Before the hands-on work begins, you need a clear target for the analysis. You are building a Taxi Operations SQL Report that helps a transport operations team identify high-activity pickup areas with high fare amounts.
Set Up the SQL Notebook
Your report needs a reliable starting point. A small notebook check confirms that the built-in taxi table is available before you begin the analysis.
Databricks Free Edition runs SQL in a browser notebook. You will create that notebook before confirming the six report fields in a ten-row result.
In this step, get ready to:
- Create a SQL notebook named Taxi Operations SQL Report.
- Run a sample query against samples.nyctaxi.trips.
- Identify the six fields needed for the operations report.
Create the SQL notebook
A notebook keeps each query beside its result. A clear name makes this analysis easy to find when you return to your workspace.
- Go to Databricks Free Edition in your browser.
- Sign in with your Databricks Free Edition account.
- Select New in the sidebar.
- Select Notebook.
You will see a blank notebook with its first cell ready for a query.
- Rename the notebook to Taxi Operations SQL Report.
- Use the first cell's language selector to choose SQL.
You are in the right place. The notebook now has a clear project name with a SQL cell ready to run.
Notebook not opening?
Confirm that you are signed in to your Databricks Free Edition workspace. Return to the sidebar after the workspace finishes loading.
If the notebook page still does not load, ask for help checking your Databricks workspace access.
Run the sample query and identify the fields
The built-in samples.nyctaxi.trips table contains New York City taxi trip details. A small result confirms that your notebook can read the table.
Before you run the first query, do you expect a single value or a grid of trip records?
- Test the notebook connection by running this query with Shift+Enter:
SELECT * FROM samples.nyctaxi.trips LIMIT 10;
What does this query do?
- SELECT * returns every available column for each selected trip.
- FROM samples.nyctaxi.trips reads records from the built-in taxi sample table.
- LIMIT 10 keeps the result small enough to inspect quickly.
You will see a result table containing 10 taxi-trip rows. That first result proves your notebook can query the sample data.
Query not returning rows?
Confirm that the cell language is set to SQL. Check that the table name matches samples.nyctaxi.trips exactly.
If the query still fails, ask for help checking the notebook query.
The result headers provide a quick preview of the table's structure. The report uses six of these fields.
- Locate the two time fields: tpep_pickup_datetime and tpep_dropoff_datetime.
- Locate the two trip-measure fields: trip_distance and fare_amount.
- Locate the two location fields: pickup_zip and dropoff_zip.
How do these fields support the report?
- The pickup timestamp records when a trip starts. The drop-off timestamp records when it ends.
- Trip distance measures how far the taxi travels. Fare amount captures the value of the trip.
- Pickup ZIP identifies the starting area. Drop-off ZIP identifies the destination area.
You should see exactly 10 rows with all six named column headers available in the result. Your first SQL result is live, so the notebook is ready for the focused analysis ahead.
Your notebook can now reach the taxi sample table. Next, you will replace the broad sample view with a focused inspection of the fields that matter.
Inspect the Raw Taxi Trips
Your Databricks Free Edition notebook can already reach the NYC taxi sample table. Now you need a readable view of the fields that matter to the operations report.
A focused SQL query can reveal the details stored in each trip. This step tests whether those individual rows can answer which pickup areas create the most activity or fare amount.
In this step, get ready to:
- Select the six fields needed for the operations report.
- Produce a 20-row sample in pickup-time order.
- Identify the reporting question that individual trip rows cannot answer.
Build the focused inspection query
Selecting named columns makes the result easier to read. Sorting by pickup time gives the sample a clear sequence.
- Select all text in the SQL cell containing the sample query from the previous step.
- Replace the selected text by pasting this raw inspection query:
-- 1. Inspect the raw taxi trips.
SELECT
tpep_pickup_datetime,
tpep_dropoff_datetime,
trip_distance,
fare_amount,
pickup_zip,
dropoff_zip
FROM samples.nyctaxi.trips
ORDER BY tpep_pickup_datetime
LIMIT 20;
What does this query do?
- The SELECT list keeps the output focused on the six report fields.
- The FROM samples.nyctaxi.trips clause reads the built-in NYC taxi records.
- The ORDER BY tpep_pickup_datetime clause arranges the trips by pickup time.
- The LIMIT 20 clause keeps the inspection readable.
Before you run the query, consider whether these rows can reveal which pickup area has the most activity.
- Run the cell by pressing Shift+Enter.
You'll see a table containing 20 individual taxi trips. The output does not calculate pickup-area totals.
Query not running?
- Confirm that the notebook cell uses SQL.
- Check the commas between the selected fields.
- Confirm that samples.nyctaxi.trips matches the table name from the previous step.
Help me troubleshoot this raw taxi inspection query.
Inspect the 20-row result
The result header confirms which fields are available for each trip. The row order confirms that the inspection query follows pickup time.
- Scan the result header from left to right.
- Count the displayed result rows.
- Compare the first displayed pickup time with the last displayed pickup time.
What should the header contain?
- The tpep_pickup_datetime field shows the pickup time.
- The tpep_dropoff_datetime field shows the drop-off time.
- The trip_distance field shows the distance travelled.
- The fare_amount field shows the recorded fare.
- The pickup_zip field identifies the pickup area.
- The dropoff_zip field identifies the drop-off area.
The result contains 20 rows in pickup-time order. Each row still represents one taxi trip.
Confirm the reporting gap
Operational questions need values that summarize activity across many trips. The current output still presents each trip separately.
Before you run the query again, consider whether the same output can identify the pickup ZIP code with the highest trip count.
- Run the inspection query again by pressing Shift+Enter.
You'll see 20 individual trips ordered by tpep_pickup_datetime. No row gives pickup-area trip counts or fare totals.
That is the key insight from this inspection: raw trip rows cannot rank pickup areas by activity or fare amount.
✔️ Awesome, I've got everything!
Your notebook now contains the complete raw inspection query for this stage.
ⓧ I'd like to double check the full code
- Compare the SQL in your notebook with this cumulative project file.
-- 1. Inspect the raw taxi trips.
SELECT
tpep_pickup_datetime,
tpep_dropoff_datetime,
trip_distance,
fare_amount,
pickup_zip,
dropoff_zip
FROM samples.nyctaxi.trips
ORDER BY tpep_pickup_datetime
LIMIT 20;
What this file contains
This file contains the complete raw inspection statement for this point in the project.
You have proved where individual trip rows stop being useful for operations reporting. Next, you'll remove unusable records and classify the remaining trips by distance.
Clean and Classify the Trips
Your raw inspection in Databricks exposed the limits of individual trip rows. Non-positive fares or distances can weaken the operations analysis.
A cleaned SQL query removes those values before assigning each trip a distance category. These categories make raw distances easier to discuss in the pickup-area report.
In this step, get ready to:
- Filter out trips with non-positive fares or distances.
- Classify each remaining trip as Short, Medium, or Long.
- Inspect 20 cleaned records from highest fare to lowest.
Build the cleaned trip query
The WHERE clause controls which records enter the result. Both conditions must be true because they are joined by AND.
The CASE expression checks each distance from top to bottom. The first matching condition determines the value stored under the trip_category alias.
- Add a second SQL cell directly below the raw inspection cell.
- Paste the cleaned query into the second cell using the code below:
-- 2. Keep positive fares and distances, then classify each trip.
SELECT
tpep_pickup_datetime,
tpep_dropoff_datetime,
trip_distance,
fare_amount,
pickup_zip,
dropoff_zip,
CASE
WHEN trip_distance < 2 THEN 'Short'
WHEN trip_distance < 5 THEN 'Medium'
ELSE 'Long'
END AS trip_category
FROM samples.nyctaxi.trips
WHERE fare_amount > 0
AND trip_distance > 0
ORDER BY fare_amount DESC
LIMIT 20;
What does this query do?
- The WHERE clause removes rows that cannot support the fare analysis.
- The first condition keeps fares greater than 0.
- The second condition keeps distances greater than 0.
- The first WHEN branch labels distances below 2 as Short.
- The second WHEN branch labels the remaining distances below 5 as Medium.
- The ELSE branch labels every remaining distance as Long.
- The final two clauses sort fares from highest to lowest before limiting the result to 20 rows.
- Run the cleaned query by pressing Shift+Enter.
You should see 20 rows with a new trip_category column. The highest displayed fare should appear at the top.
That cleanup layer is working. Your notebook can now turn each valid distance into an operations-friendly label.
Query not running?
Check that the comma after dropoff_zip is present. Confirm that every category uses matching single quotes.
Compare the CASE expression with the code above. It must finish with END AS trip_category.
Help me debug my cleaned taxi trip SQL query in Databricks.
Verify the cleaned result
A successful query must prove that every displayed record passes both filters. Each category must also follow the distance boundaries in the CASE expression.
Before you rerun the query, do you expect any zero or negative fare or distance to remain?
- Rerun the cleaned query by pressing Shift+Enter.
- Check the fare_amount column for positive values.
- Check the trip_distance column for positive values.
- Confirm that each trip_category value is Short, Medium, or Long.
- Confirm that the fare_amount values descend from highest to lowest.
Every displayed row should have a positive fare and distance. Each row should carry one of the three distance categories.
✔️ Awesome, I've got everything!
Your notebook now contains the raw inspection query plus a working cleaned query. The cleaned result filters unusable records before classifying each trip.
ⓧ I'd like to double check the full code
- Compare both SQL cells in your notebook with this cumulative reference:
-- 1. Inspect the raw taxi trips.
SELECT
tpep_pickup_datetime,
tpep_dropoff_datetime,
trip_distance,
fare_amount,
pickup_zip,
dropoff_zip
FROM samples.nyctaxi.trips
ORDER BY tpep_pickup_datetime
LIMIT 20;
-- 2. Keep positive fares and distances, then classify each trip.
SELECT
tpep_pickup_datetime,
tpep_dropoff_datetime,
trip_distance,
fare_amount,
pickup_zip,
dropoff_zip,
CASE
WHEN trip_distance < 2 THEN 'Short'
WHEN trip_distance < 5 THEN 'Medium'
ELSE 'Long'
END AS trip_category
FROM samples.nyctaxi.trips
WHERE fare_amount > 0
AND trip_distance > 0
ORDER BY fare_amount DESC
LIMIT 20;
This reference preserves the raw inspection as the first query. It adds the cleaned and classified result as the second query.
Your notebook now produces a trustworthy set of classified trips. Next, you will group those records into pickup-area metrics that an operations team can use.
Build the Pickup Area Report
Your Databricks Free Edition notebook now contains usable taxi trips with distance labels. These individual rows still make pickup areas difficult to compare.
In this step, SQL aggregate functions will turn those trips into one summary per pickup ZIP code. A data visualization will make the leading areas visible at a glance.
In this step, get ready to:
- Group positive taxi trips by pickup ZIP code.
- Calculate trip volume plus three fare and distance metrics.
- Create a Bar visualization of total fare amount by pickup ZIP code.
Build the grouped report
A grouped report collapses many trip records into one row for each pickup ZIP code. Each aggregate metric answers a specific operations question about that area.
- Add a SQL cell below the cleaned classified query in the notebook from earlier.
- Build the pickup-area summary by pasting this query into the new cell:
-- 3. Build the pickup-area operations report.
SELECT
pickup_zip,
COUNT(*) AS trip_count,
ROUND(AVG(trip_distance), 2) AS avg_trip_distance,
ROUND(AVG(fare_amount), 2) AS avg_fare_amount,
ROUND(SUM(fare_amount), 2) AS total_fare_amount
FROM samples.nyctaxi.trips
WHERE fare_amount > 0
AND trip_distance > 0
GROUP BY pickup_zip
HAVING COUNT(*) >= 100
ORDER BY total_fare_amount DESC
LIMIT 10;
What does this query do?
- The WHERE clause keeps fares above zero. It also keeps distances above zero.
- The GROUP BY pickup_zip clause creates one result row for each pickup ZIP code.
- The COUNT(*) calculation stores each area's trip volume in trip_count.
- The AVG(trip_distance) calculation measures the typical distance for each area.
- The AVG(fare_amount) calculation measures the typical fare for each area.
- The SUM(fare_amount) calculation produces total_fare_amount for each area.
- The ROUND calculations keep the averages plus the total at two decimal places.
- The HAVING COUNT(*) >= 100 clause keeps pickup areas with at least 100 valid trips. This threshold is a project rule for focusing the report.
- The ORDER BY total_fare_amount DESC clause places the highest total first.
- The LIMIT 10 clause keeps the result focused on ten pickup areas.
Before you run the query, do you expect to see one row per trip or one row per pickup ZIP code?
- Run the report cell by pressing Shift+Enter.
You'll see up to 10 pickup ZIP rows ordered by total_fare_amount from highest to lowest. Each row contains the area's trip count plus its rounded distance and fare metrics.
You have closed the raw-row reporting gap. The first row now identifies the highest-value qualifying pickup area.
Query not running?
- Check that every metric line before FROM ends with a comma except the final metric.
- Confirm that WHERE appears before GROUP BY.
- Confirm that HAVING appears after GROUP BY.
- Compare the four aliases with the report query above.
Help me debug the pickup-area SQL query.
✔️ Awesome, I've got everything!
Your notebook now contains three SQL cells in order. The third cell returns the grouped pickup-area operations report.
ⓧ I'd like to double check the full code
- Compare the three SQL cells in your notebook with this complete analysis:
-- 1. Inspect the raw taxi trips.
SELECT
tpep_pickup_datetime,
tpep_dropoff_datetime,
trip_distance,
fare_amount,
pickup_zip,
dropoff_zip
FROM samples.nyctaxi.trips
ORDER BY tpep_pickup_datetime
LIMIT 20;
-- 2. Keep positive fares and distances, then classify each trip.
SELECT
tpep_pickup_datetime,
tpep_dropoff_datetime,
trip_distance,
fare_amount,
pickup_zip,
dropoff_zip,
CASE
WHEN trip_distance < 2 THEN 'Short'
WHEN trip_distance < 5 THEN 'Medium'
ELSE 'Long'
END AS trip_category
FROM samples.nyctaxi.trips
WHERE fare_amount > 0
AND trip_distance > 0
ORDER BY fare_amount DESC
LIMIT 20;
-- 3. Build the pickup-area operations report.
SELECT
pickup_zip,
COUNT(*) AS trip_count,
ROUND(AVG(trip_distance), 2) AS avg_trip_distance,
ROUND(AVG(fare_amount), 2) AS avg_fare_amount,
ROUND(SUM(fare_amount), 2) AS total_fare_amount
FROM samples.nyctaxi.trips
WHERE fare_amount > 0
AND trip_distance > 0
GROUP BY pickup_zip
HAVING COUNT(*) >= 100
ORDER BY total_fare_amount DESC
LIMIT 10;
Create the Bar visualization
The table preserves exact values for inspection. A Bar visualization makes the differences in total fare amount easier to compare.
Before you build the visualization, which row in the sorted table do you expect to produce the tallest bar?
- Select + next to the Table tab below the report result.
- Select Visualization.
- Choose Bar.
- Map pickup_zip to the pickup ZIP code axis.
- Map total_fare_amount to the total fare amount axis.
- Select Save.
You'll see a saved Bar visualization with pickup ZIP codes as categories. Each bar represents the area's total fare amount.
The tallest bar corresponds to the first row in the sorted result table. You can now identify the leading pickup area without scanning every value.
Chart blank or mapped incorrectly?
- Confirm that the report query completed with rows before creating the visualization.
- Check that pickup_zip supplies the pickup ZIP code axis.
- Check that total_fare_amount supplies the total fare amount axis.
- Reopen the visualization settings if the bars do not match the report values.
Help me fix the pickup-area Bar visualization.
Your notebook now turns individual taxi trips into a visual operations report. Next, you will publish the analysis in a public GitHub repository that recruiters can inspect.
Publish the Portfolio Evidence
Your Databricks notebook now turns taxi trips into a pickup-area report. However, the notebook remains inside your workspace.
A public GitHub repository gives recruiters a readable SQL artifact. It also explains the business value without requiring Databricks access.
In this step, get ready to:
- Create a public GitHub repository for the analysis.
- Add a recruiter-friendly project explanation to README.md.
- Publish the completed SQL for anyone to inspect.
Create the public GitHub repository
The repository becomes the public home for your analysis. Its visibility lets someone inspect your work without joining your Databricks workspace.
- Open GitHub in a new browser tab.
- Sign in to GitHub.
- Select New repository from the top navigation.
- Select your account in the Owner field.
- Enter databricks-sql-taxi-analysis as the repository name.
- Select Public as the repository visibility.
- Select Add README.
- Select Create repository.
Good work. Your analysis now has a public home with a starter README.
- Record the repository URL here: https://github.com/your-username/databricks-sql-taxi-analysis.
Document the analysis in README.md
A README gives the SQL context before anyone opens the query file. It connects the report to clear business questions.
- Select README.md in the repository file list.
- Use the pencil-shaped control above the file content to open the editor.
- Replace the starter text with the project overview by pasting this content:
# Databricks SQL Taxi Operations Report
## Project overview
This project uses SQL in Databricks Free Edition to turn individual New York City taxi trips into an operations report grouped by pickup ZIP code.
## Business questions
- Which pickup areas have enough trip activity to include in an operations report?
- Which qualifying pickup areas generate the highest total fare amount?
- What are the average trip distance and average fare in each qualifying area?
What does this section explain?
- The project overview states what the report does.
- The business questions show why the analysis matters to an operations team.
- Select Preview above the editor.
You should see the project title followed by the overview. You should also see three business questions in a bullet list.
Does the preview look incomplete?
Check that the overview sits under its heading. Confirm that each business question begins on a separate line.
Help me fix the opening sections of my GitHub README.
- Return to the file editor.
- Add the skills list and data source on the blank line by pasting this content:
## Skills demonstrated
- Selecting and sorting relevant columns
- Filtering unusable records with `WHERE`
- Classifying records with `CASE`
- Aggregating records with `COUNT`, `AVG`, and `SUM`
- Filtering grouped results with `HAVING`
- Creating a Databricks visualization
- Documenting SQL work for a technical portfolio
## Data source
The analysis queries the `samples.nyctaxi.trips` table included in the Databricks `samples` catalog.
Why include skills and data?
- The skills list makes each SQL technique easy to scan.
- The data source identifies the exact sample table behind the analysis.
- Select Preview above the editor.
You should see seven demonstrated skills. The data source should show the taxi table plus its catalog.
Are the skills running together?
Confirm that every skill starts with a hyphen on its own line. Keep a blank line before the data source heading.
Help me correct the Markdown list in my GitHub README.
- Return to the file editor.
- Complete the README with run instructions by pasting this content on the blank line:
## How to run the analysis
1. Create a SQL notebook in Databricks Free Edition.
2. Copy the statements from `taxi_operations_report.sql` into separate SQL cells.
3. Run each cell in order.
4. Create a Bar visualization from the final query using pickup ZIP code and total fare amount.
## Report output
The final query returns qualifying pickup ZIP codes with trip count, average trip distance, average fare, and total fare amount. Results are ordered from the highest total fare amount to the lowest and limited to 10 rows.
## Next improvement
Add an explicit pickup-area rank using a common table expression and a window function.
How does this finish the README?
- The run instructions make the analysis reproducible.
- The report output describes the final table.
- The next improvement points toward reusable ranking logic.
- Select Preview above the editor.
- Select Commit changes... after confirming the preview.
- Confirm the update in the commit dialog.
The repository page should now render the complete project explanation below the file list. Your SQL work has the context a reviewer needs.
Is the README missing a section?
Return to the file editor to compare each heading with the reference below. Check for an accidental deletion near the missing section.
Help me find a missing section in my project README.
✔️ Awesome, I've got everything!
Your saved README now explains the project purpose. It also documents the questions and the demonstrated skills.
ⓧ I'd like to double check the full code
- Compare your complete README.md file with this reference:
# Databricks SQL Taxi Operations Report
## Project overview
This project uses SQL in Databricks Free Edition to turn individual New York City taxi trips into an operations report grouped by pickup ZIP code.
## Business questions
- Which pickup areas have enough trip activity to include in an operations report?
- Which qualifying pickup areas generate the highest total fare amount?
- What are the average trip distance and average fare in each qualifying area?
## Skills demonstrated
- Selecting and sorting relevant columns
- Filtering unusable records with `WHERE`
- Classifying records with `CASE`
- Aggregating records with `COUNT`, `AVG`, and `SUM`
- Filtering grouped results with `HAVING`
- Creating a Databricks visualization
- Documenting SQL work for a technical portfolio
## Data source
The analysis queries the `samples.nyctaxi.trips` table included in the Databricks `samples` catalog.
## How to run the analysis
1. Create a SQL notebook in Databricks Free Edition.
2. Copy the statements from `taxi_operations_report.sql` into separate SQL cells.
3. Run each cell in order.
4. Create a Bar visualization from the final query using pickup ZIP code and total fare amount.
## Report output
The final query returns qualifying pickup ZIP codes with trip count, average trip distance, average fare, and total fare amount. Results are ordered from the highest total fare amount to the lowest and limited to 10 rows.
## Next improvement
Add an explicit pickup-area rank using a common table expression and a window function.
How to use this reference
Check the heading order first. Compare the text under each heading after the structure matches.
Publish the SQL and verify public access
The README explains your decisions. The SQL file provides direct evidence of the queries that produced the report.
- Select Add file above the repository file list.
- Select Create new file.
- Enter taxi_operations_report.sql as the filename.
- Add the raw inspection query by pasting this code into the file editor:
-- 1. Inspect the raw taxi trips.
SELECT
tpep_pickup_datetime,
tpep_dropoff_datetime,
trip_distance,
fare_amount,
pickup_zip,
dropoff_zip
FROM samples.nyctaxi.trips
ORDER BY tpep_pickup_datetime
LIMIT 20;
What does this query prove?
- The selected columns focus the inspection on trip timing and fare analysis.
- The sort order places the trips in pickup-time order.
- The row limit keeps the inspection readable.
- Check that the first statement ends with LIMIT 20;.
The editor should show one complete raw inspection statement. Its first line should describe the query's purpose.
Does the first query look truncated?
Check that the six selected columns appear before the table name. Confirm that the statement ends with a semicolon.
Help me check the raw inspection query in my SQL file.
- Add the cleaned classification query on the blank line by pasting this code:
-- 2. Keep positive fares and distances, then classify each trip.
SELECT
tpep_pickup_datetime,
tpep_dropoff_datetime,
trip_distance,
fare_amount,
pickup_zip,
dropoff_zip,
CASE
WHEN trip_distance < 2 THEN 'Short'
WHEN trip_distance < 5 THEN 'Medium'
ELSE 'Long'
END AS trip_category
FROM samples.nyctaxi.trips
WHERE fare_amount > 0
AND trip_distance > 0
ORDER BY fare_amount DESC
LIMIT 20;
What does the cleaned query demonstrate?
- The filters remove records that cannot support positive fare analysis.
- The case expression converts distance values into three named categories.
- The descending fare order brings the highest fares to the top.
- Check that the second statement includes trip_category.
The editor should now show two complete statements. The second statement should include the Short, Medium, and Long labels.
Is a trip category missing?
Compare all three category labels with the notebook query. Check that the case expression closes before the table name.
Help me check the classification query in my SQL file.
- Complete the SQL file with the pickup-area report by pasting this code on the blank line:
-- 3. Build the pickup-area operations report.
SELECT
pickup_zip,
COUNT(*) AS trip_count,
ROUND(AVG(trip_distance), 2) AS avg_trip_distance,
ROUND(AVG(fare_amount), 2) AS avg_fare_amount,
ROUND(SUM(fare_amount), 2) AS total_fare_amount
FROM samples.nyctaxi.trips
WHERE fare_amount > 0
AND trip_distance > 0
GROUP BY pickup_zip
HAVING COUNT(*) >= 100
ORDER BY total_fare_amount DESC
LIMIT 10;
What does the report query demonstrate?
- The grouping converts individual trips into pickup-area metrics.
- The aggregate functions measure activity and fare performance.
- The grouped-result filter keeps areas that meet the project threshold.
- The final sort places the highest total fare amount first.
- Select Commit changes... below the file editor.
- Confirm the new file in the commit dialog.
The repository file list should now include taxi_operations_report.sql. Opening it should display all three completed statements.
Is the SQL file missing?
Check that you confirmed the commit after leaving the editor. Return to the repository file list after the commit completes.
Help me find the SQL file I created in my GitHub repository.
✔️ Awesome, I've got everything!
Your repository now contains the project documentation. It also contains the complete three-query analysis.
ⓧ I'd like to double check the full code
- Compare your complete taxi_operations_report.sql file with this reference:
-- 1. Inspect the raw taxi trips.
SELECT
tpep_pickup_datetime,
tpep_dropoff_datetime,
trip_distance,
fare_amount,
pickup_zip,
dropoff_zip
FROM samples.nyctaxi.trips
ORDER BY tpep_pickup_datetime
LIMIT 20;
-- 2. Keep positive fares and distances, then classify each trip.
SELECT
tpep_pickup_datetime,
tpep_dropoff_datetime,
trip_distance,
fare_amount,
pickup_zip,
dropoff_zip,
CASE
WHEN trip_distance < 2 THEN 'Short'
WHEN trip_distance < 5 THEN 'Medium'
ELSE 'Long'
END AS trip_category
FROM samples.nyctaxi.trips
WHERE fare_amount > 0
AND trip_distance > 0
ORDER BY fare_amount DESC
LIMIT 20;
-- 3. Build the pickup-area operations report.
SELECT
pickup_zip,
COUNT(*) AS trip_count,
ROUND(AVG(trip_distance), 2) AS avg_trip_distance,
ROUND(AVG(fare_amount), 2) AS avg_fare_amount,
ROUND(SUM(fare_amount), 2) AS total_fare_amount
FROM samples.nyctaxi.trips
WHERE fare_amount > 0
AND trip_distance > 0
GROUP BY pickup_zip
HAVING COUNT(*) >= 100
ORDER BY total_fare_amount DESC
LIMIT 10;
How to use this reference
Check that each query ends with a semicolon. Confirm that a single blank line separates the statements.
Before you check the public view, which two files do you expect to find in the repository?
- Open a private browsing window from your browser menu.
- Paste https://github.com/your-username/databricks-sql-taxi-analysis into the browser address bar.
- Press Enter to load the repository.
You should see README.md in the file list. You should also see taxi_operations_report.sql.
The repository should load without a GitHub sign-in prompt. This confirms that recruiters can inspect the project publicly.
Does the repository ask you to sign in?
Return to the signed-in repository to confirm its visibility is set to Public. Check that the private window uses the repository URL you recorded.
Help me troubleshoot public access to my GitHub repository.
That is the portfolio gap closed. Recruiters can now inspect your analysis without access to your workspace.
Secret mission
Rank the Highest-Value Pickup Areas
Your pickup report already sorts pickup areas by total fare amount. This mission adds an explicit rank with a reusable CTE plus a ranking window function. You will publish the result as a separate SQL file.
Clean Up Your Resources
Clean Up Your Resources
Your Databricks Free Edition notebook and GitHub Free repository are no-cost resources. Choose whether to keep both artifacts, pause with them saved, or delete them entirely.
Resources you used:
- Databricks notebook Taxi Operations SQL Report with saved SQL results and a Bar visualization.
- Public GitHub repository databricks-sql-taxi-analysis with three committed project files.
Keep everything running
No action needed. Choose this if you want to keep using your report or extend the analysis.
- Leave Taxi Operations SQL Report saved in your Databricks workspace.
- Leave databricks-sql-taxi-analysis public on GitHub.
Pause - I'll come back to this later
Stop working without removing either artifact. Your saved notebook and repository remain available when you return.
- Leave Taxi Operations SQL Report saved in the Databricks workspace.
- Leave databricks-sql-taxi-analysis saved on GitHub.
- Close your browser tabs when you finish.
Delete - I don't want to use this again
Deletion permanently removes both artifacts. A separate backup is the only way to keep a copy.
Delete the Databricks notebook:
- Switch back to the Taxi Operations SQL Report notebook from earlier.
- Open the notebook actions menu in the notebook header.
- Choose its workspace deletion option.
- Return to your Databricks workspace notebook list.
- Confirm that Taxi Operations SQL Report no longer appears.
Delete the GitHub repository:
- Return to the databricks-sql-taxi-analysis repository from earlier.
- Open the repository settings.
- Move to the repository deletion controls.
- Use the deletion control for databricks-sql-taxi-analysis.
- Complete GitHub's on-screen confirmation prompt.
- Visit the repository's former public page in a signed-out or private browser window.
You should see that databricks-sql-taxi-analysis is no longer publicly available.
Nice Work!
Nice Work!
You did it! You built a taxi operations report with Databricks SQL. Your public GitHub repository now gives recruiters clear evidence of your SQL skills.
You've learned how to:
- Turn raw taxi trips into cleaned trip records with positive fares and distances. Classify each trip as Short, Medium, or Long with WHERE and CASE.
- Build a pickup-area report with trip count, average distance, average fare, and total fare amount. Show the leading pickup areas in a saved Bar visualization.
- Publish a public GitHub repository containing a recruiter-friendly README.md file and the complete taxi_operations_report.sql analysis.
- Secret Mission: Complete the optional challenge with a reusable zip_summary common table expression. Add a ranking window function that assigns revenue_rank by total fare amount.
Ready to quiz yourself?