FastPrepDuplicate Rows
Problems/Duplicate Rows

Duplicate Rows

Bank of America logoBank of America● EasyNEW GRADONSITE INTERVIEW

Updated Oct 2023

QuestionConstraints

Problem statement

Source note: Reported by three Bank of America new grads from campus hiring drives, in live technical rounds after the video step. All three had to write an SQL query that finds the rows a table holds more than once; one was also asked for the table's distinct rows.

The reports give no table or data. Here, a contact list that was loaded twice holds the repeats, a row counts as repeated only when every column matches, and each repeated row is listed once with its number of copies. Getting the distinct rows is the same grouping without the filter, and the solution shows it. The table and all data are ours.

Our version is about 80% the same as the reported question.

A branch imported its customer contact list into the customer_contacts table, and part of the file was loaded more than once. The table has no key, so the same row can appear several times.

Write a query that finds the repeated rows. Two rows are copies of each other only when full_name, email and city are all equal; rows that share just a name or an email are different rows.

Return each row that appears two or more times exactly once, with its three columns and a fourth column copies: the number of times that row appears in the table. Rows that appear only once are left out. Return the rows in any order.

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.

customer_contacts

Imported contact rows; the same row can appear more than once.

ColumnTypeNullableDescription
full_nameTextNoCustomer's name.
emailTextNoCustomer's email address.
cityTextNoCustomer's city.

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
full_nameTextNo—
emailTextNo—
cityTextNo—
copiesIntegerNo—

Row order: any order is accepted. Numeric tolerance: 0.

Constraints

  • The customer_contacts table has between 1 and 1000 rows.
  • No column is ever NULL.
  • full_name has 1 to 40 characters, email 3 to 60 and city 1 to 30, all printable ASCII with no leading or trailing spaces.
  • email is all lowercase, and no two values in the same column differ only in letter case.

More Bank of America Onsite Interview questions

  • Centered Star PyramidONSITE INTERVIEW · Seen Nov 2025
  • Employees Without a ManagerONSITE INTERVIEW · Seen Nov 2025
  • Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Nov 2025
  • N-th Fibonacci NumberONSITE INTERVIEW · Seen Nov 2025
  • Reverse Each Word in a SentenceONSITE INTERVIEW · Seen Nov 2025
  • Second Highest SalaryONSITE INTERVIEW · Seen Nov 2025
  • Three Numbers That Add Up to a TargetONSITE INTERVIEW · Seen Apr 2025
  • Factorial of a NumberONSITE INTERVIEW · Seen Oct 2023
  • Palindrome String CheckONSITE INTERVIEW · Seen Sep 2023
  • Second Largest Element in an ArrayONSITE INTERVIEW · Seen Jun 2023

Similar questions at other companies

  • Delete Duplicate Employee RecordsInfosys · ONSITE INTERVIEWInfosys interview questions
  • Records Created or Updated in a Time WindowPelatro · ONSITE INTERVIEW
  • Top Ten Employee SalariesSolytics Partners · ONSITE INTERVIEW
  • Latest New JobSphere · ONSITE INTERVIEW
  • Employees Whose Manager Left the CompanyZS · ONSITE INTERVIEWZS interview questions
  • Employees Above Average SalaryJP Morgan Chase · ONSITE INTERVIEWJP Morgan Chase interview questions
  • Retrieve Every Student RecordLSEG · ONSITE INTERVIEWLSEG interview questions
  • Combine Winner and Loser NamesAmazon · ONSITE INTERVIEW
  • Conditionally Insert or Update RecordsKlaviyo · ONSITE INTERVIEWKlaviyo interview questions
  • Employees with Matching DepartmentsAMD · ONSITE INTERVIEWAMD interview questions

Bank of America interview experiences

  • Bank of America interviews · December 2025
  • Bank of America OA · December 2025
  • Bank of America interviews · September 2026
  • Bank of America OA · September 2026
All Bank of America interview questionsSee Bank of America hiring insights