FastPrepSummarize Customer Records

Summarize Customer Records

Agoda logoAgoda● MediumFULLTIMEOA

Problem statement

Analyze a customer dataset with company, city, country, employee-count, contract-count, and contract-cost fields.

Return a normalized summary containing:

  1. the total customer count;
  2. customer counts for every city in ascending city order;
  3. customer counts for every country in ascending country order;
  4. the country with the largest sum of signed contracts and that sum; and
  5. the number of unique cities.

If several countries tie for the largest contract count, select the alphabetically larger country using case-sensitive comparison.

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

ColumnTypeNullableDescription
IDTextNo—
NAMETextNo—
CITYTextNo—
COUNTRYTextNo—
CPERSONTextNo—
EMPLCNTIntegerNo—
CONTRCNTIntegerNo—
CONTRCOSTDecimalNo—

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
metricTextNo—
keyTextYes—
valueIntegerNo—

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, and value.

More Agoda problems

See Agoda hiring insights