Problem · Database

Customer Package Delivery Report

EasyAmazon logoAmazonOA
See Amazon hiring insights

Problem statement

Amazon's shipping team needs a report of customer packages that are still in the delivery process. FastPrep provides one packages table where each row represents one package.

Return email, total_packages, and total_weight for each customer. Include only packages whose status is created, shipped, or on hold.

Sort by total_weight descending. When two customers have the same total weight, sort by email ascending so the result is deterministic.

Practice-schema note: the reported interview prompt did not include its original table DDL. This exercise uses the single-table schema shown below to make the reported aggregation executable without inventing customer identifiers or joins.

Table schema

MySQLPostgreSQLPandas

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.

packages

One row per customer package in the FastPrep practice schema.

ColumnTypeNullableDescription
emailTextNoEmail address associated with the package.
weightDecimalNoExact package weight.
statusTextNoCurrent delivery status.

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
emailTextNo
total_packagesIntegerNo
total_weightDecimalNo

Row order: must match exactly. Numeric tolerance: 0.

Constraints

  • Status values are matched to the three values listed above.
  • total_packages counts eligible package rows.
  • total_weight sums eligible package weights exactly.
  • Customers with no eligible packages do not appear.

More Amazon problems