Inner Join Orders with Customers
PYSPARK coding challenge · Difficulty: easy · Topic: Joins · +50 XP
Problem
Inner-join them on customer_id and return df_result ordered by order_id.
Example Input - `orders`
| order_id | customer_id | amount | | --- | --- | --- | | 1 | 101 | 250 | | 2 | 102 | 180 |
Example Input - `customers`
| customer_id | name | | --- | --- | | 101 | Asha | | 102 | Ravi |
Expected Output
| customer_id | order_id | amount | name | | --- | --- | --- | --- | | 101 | 1 | 250 | Asha | | 102 | 2 | 180 | Ravi |
Notes
- The DataFrame is created for you - do not recreate it
- Build a DataFrame called
df_resultand finish withdf_result.show()
What this PYSPARK challenge teaches you
“Inner Join Orders with Customers” is a easy-level PYSPARK challenge focused on Joins. Working through it gives you hands-on practice with beginner — the kind of transformation you are asked to write in real data engineering work and in technical interviews. You can solve it directly in the browser: the dataset is pre-loaded, so you write the query or DataFrame code, run it, and compare your output against the expected result immediately.
Concepts covered
- beginner
How to approach it
If you get stuck, work through these steps in order before looking at a full solution — each one narrows the problem down:
- join() matches rows between two DataFrames. When both sides share the column name, one string is enough.
- orders.join(customers, 'customer_id') — passing the name as a string avoids a duplicated column. Then .orderBy('order_id').
How to practise it on PySpark.in
Open the challenge, write your PySpark code in the editor and press Run to execute it against the sample dataset. Submitting checks your output against every test case, including hidden ones, so you find out straight away whether your logic holds up. You can retry as often as you like, and each solved challenge adds to your XP.
Related PYSPARK challenges
- Find Customers Missing from New Table
- Customers With at Least One Order
- Customers Who Have Never Placed an Order
- Count Orders Per Customer Including Zero
- Total Amount Spent Per Customer (With Zero)
- Find Employees in the HR Department
Frequently asked questions
Do I need to install Spark or a database to solve this?
No. The PYSPARK environment runs in your browser with the sample data already loaded, so there is nothing to install or configure.
Is this challenge free?
Yes - the problem, the sample dataset, the hints and unlimited test runs are free.
What level is it?
It is rated easy and covers Joins.