FastPrepHigh Resource Usage Customers

High Resource Usage Customers

Wells Fargo logoWells Fargo● MediumNEW GRADOA

Problem statement

Identify every customer with at least one site_data log where memory utilization, disk utilization, or CPU utilization is strictly greater than 50%.

For each qualifying customer, calculate averages across all of that customer's logs:

  • average_memory_usage: average of 100 * memory_used_gb / memory_allocated_gb.
  • average_disk_storage: average of 100 * disk_used_gb / disk_allocated_gb.
  • average_cpu_utilization: average of cpu_utilization_percent.

Round every average to two decimal places. Return rows ordered by customer_name ascending, then customer_id ascending.

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.

customers

Customer identities.

ColumnTypeNullableDescription
customer_idPKIntegerNo—
customer_nameTextNo—

site_data

Resource-usage logs for monitored customer sites.

ColumnTypeNullableDescription
log_idPKIntegerNo—
customer_idIntegerNo—
memory_used_gbDecimalNo—
memory_allocated_gbDecimalNo—
disk_used_gbDecimalNo—
disk_allocated_gbDecimalNo—
cpu_utilization_percentDecimalNo—

Foreign key: customer_id → customers(customer_id)

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
customer_nameTextNo—
average_memory_usageDecimalNo—
average_disk_storageDecimalNo—
average_cpu_utilizationDecimalNo—

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

Constraints

  • customers.customer_id and site_data.log_id are unique primary keys.
  • Every site_data.customer_id references an existing customer.
  • memory_allocated_gb and disk_allocated_gb are positive.
  • Usage and allocation values are nonnegative decimals, and CPU utilization is between 0 and 100.
  • A customer may have multiple logs; averages include every log after the customer qualifies.

More Wells Fargo problems

See Wells Fargo hiring insights