Summarize Customer Records
Updated
Problem statement
You get a customer table. Each row has a company, a city, a country, an employee count, a contract count and a contract cost.
Return a summary with these parts:
- the total number of customers;
- the number of customers in each city, with cities in ascending order;
- the number of customers in each country, with countries in ascending order;
- the country with the largest sum of signed contracts, and that sum; and
- the number of different cities.
If several countries tie for the largest contract count, pick the alphabetically larger country, comparing names case-sensitively. Compare country names with case sensitivity.
Table schema
Pandas
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
customers
| Column | Type | Nullable | Description |
|---|---|---|---|
| ID | Text | No | — |
| NAME | Text | No | — |
| CITY | Text | No | — |
| COUNTRY | Text | No | — |
| CPERSON | Text | No | — |
| EMPLCNT | Integer | No | — |
| CONTRCNT | Integer | No | — |
| CONTRCOST | Decimal | No | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| metric | Text | No | — |
| key | Text | Yes | — |
| value | Integer | No | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
- All input columns follow the source schema and are non-null.
- The source's formatted multi-section output is represented as ordered rows with columns
metric,key, andvalue.
More Agoda Online Assessment questions
- Special Diameter EndpointsOA · Seen Nov 2025
- TV Series in a Production WindowOA · Seen Nov 2025
- Count One Groups by SizeOA · Seen Jul 2025
- Minimum Price With Discount CouponsOA · Seen Jul 2025
- Lexicographically Smallest Task QueueOA · Seen Jul 2025
- Highest-Ranked University by CountryOA · Seen Jun 2025
- Jump Game with Prime-3 StepsOA · Seen Jun 2025
- Team FormationOA · Seen Apr 2025
- Two-Core Process AssignmentOA · Seen Apr 2025
- Unique Digits in RangeOA · Seen Apr 2025
Similar questions at other companies
- Prepare Taxi Driver Classification DataBoston Consulting Group · OABoston Consulting Group interview questions
- Clean the TapeMillennium · OAMillennium interview questions
- Weekend Appointments for Consular Services ReschedulingMcKinsey & Company · OAMcKinsey & Company interview questions
- Benchmarking Tool ReportPalantir · OAPalantir interview questions
- In-Memory Database QueriesOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
- Latest New JobSphere · ONSITE INTERVIEW
- Second Highest SalaryHartford Financial Services · ONSITE INTERVIEWHartford Financial Services interview questions
- Subscription and Usage-Based Billing CalculatorStripe · OAStripe interview questions
- Hiking Club Fastest PaceInfosys · OAInfosys interview questions
- Earliest Meeting Time for All EmployeesCapital One · OACapital One interview questions