Problem
Write a PostgreSQL query to find the first product each customer purchased on the Apidel Technologies platform. Return the customer, the first order, its timestamp, and the product name. If two orders share the same earliest timestamp for a customer, use the smaller order_id as the tie-breaker.
Schema
customers
| Column | Type | Description |
|---|---|---|
| customer_id | INT | Primary key |
| customer_name | VARCHAR(100) | Customer name |
orders
| Column | Type | Description |
|---|---|---|
| order_id | INT | Primary key |
| customer_id | INT | Customer reference |
| product_id | INT | Product reference |
| purchased_at | TIMESTAMP | Purchase timestamp |
products
| Column | Type | Description |
|---|---|---|
| product_id | INT | Primary key |
| product_name | VARCHAR(100) | Product name |
Practicing as: Customer Insights Analyst interview at Apidel TechnologiesHi, I'll play your Apidel Technologies interviewer for the Customer Insights Analyst role. Answer the question above like we're in the room, and I'll respond the way a real interviewer would.
You are practicing as a guest. Sign up free to run your code against the sample data. Your draft stays right here.


