They gave you input and output tables and asked you to write a SQL query.
Use the provided customers and trips tables to return one row for every customer, summarizing only completed trips. Assign an activity level based on the customer's completed trip count.
customer_id, customer_name, completed_trip_count, total_completed_fare, and activity_levelNone as their activity leveltotal_completed_fare descending, then customer_id ascending| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| Column | Type | Description |
|---|---|---|
| trip_idPK | INT | Unique trip identifier |
| customer_id | INT | Customer associated with the trip |
| status | VARCHAR(20) | Trip status |
| fare_amount | NUMERIC(10,2) | Fare charged for the trip |