FastPrepBond Interest Summary Above 3%

Bond Interest Summary Above 3%

Wells Fargo logoWells Fargo● EasyINTERNOA

Problem statement

The bonds table lists bonds. The interest_rates table holds the interest rates recorded for each bond, written as percentages: 3.25 means 3.25%. A bond can have many rates.

For each bond whose average interest rate is above 3%, return bond_id, bond_name, highest_interest, average_interest, and lowest_interest.

  • Use all of a bond's rates for all three values. A rate that appears twice counts twice.
  • Check the 3% rule against the exact average. A bond whose exact average is exactly 3 is left out.
  • Round average_interest to two decimal places, with halves rounded away from zero.
  • A bond with no rates is left out.

Sort the rows by bond_id from smallest to largest.

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.

bonds

ColumnTypeNullableDescription
bond_idPKIntegerNo—
bond_nameTextNo—

interest_rates

ColumnTypeNullableDescription
rate_idPKIntegerNo—
bond_idIntegerNo—
interest_rateDecimalNo—

Foreign key: bond_id → bonds(bond_id)

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
bond_idIntegerNo—
bond_nameTextNo—
highest_interestDecimalNo—
average_interestDecimalNo—
lowest_interestDecimalNo—

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

Constraints

  • bond_id is a unique positive integer in bonds, and rate_id is a unique positive integer in interest_rates.
  • Every interest_rates.bond_id exists in bonds.
  • interest_rate is from 0.00 to 100.00, with at most two decimal places. No value is null.
  • Two bonds can have the same bond_name. They are still separate bonds.
  • Each table has at most 2000 rows.

More Wells Fargo problems

See Wells Fargo hiring insights