FastPrepFind Duplicate Employee Records
Problems/Find Duplicate Employee Records

Find Duplicate Employee Records

Infosys logoInfosys● EasyFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionConstraints

Problem statement

Source note: Reported in an Infosys full-time onsite interview. In the technical interview, the candidate was asked an SQL question to find duplicate names and IDs, followed by a question about deleting the duplicate records.

The report gives no table, columns, or output format. Here, a row counts as a copy when both its ID and its name match another row, each repeated pair is listed once, and rows are sorted by ID and then name.

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

The table employees holds employee records. Because of a data entry bug, the same record was sometimes stored more than once: two rows are copies of the same record when they have the same emp_id and the same name. Each stored row has its own row_id.

Return every emp_id and name pair that is stored more than once. List each such pair once, with the columns emp_id and name, sorted by emp_id and then by name, both from smallest to largest.

Rows with the same name but a different ID, or the same ID but a different name, are not copies of each other.

employees
ColumnMeaning
row_idUnique number of the stored row
emp_idEmployee ID
nameEmployee name

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.

employees

Employee records. The same employee record (emp_id and name) may have been stored more than once.

ColumnTypeNullableDescription
row_idPKIntegerNoUnique number of the stored row.
emp_idIntegerNoEmployee ID.
nameTextNoEmployee name.

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
emp_idIntegerNo—
nameTextNo—

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

Constraints

  • employees has at most 500 rows.
  • row_id is unique; row_id and emp_id are integers between 1 and 10^6.
  • name has 1 to 30 English letters. Two names in the table never differ only in upper or lower case.
  • No column contains NULL.

More Infosys Onsite Interview questions

  • Minimum Coins for a TargetONSITE INTERVIEW · Seen Nov 2026
  • Delete Duplicate Employee RecordsONSITE INTERVIEW · Seen Nov 2026
  • Minimum Insertion Steps to Make a String PalindromeONSITE INTERVIEW · Seen Nov 2026
  • Maximize the Even-Odd Index Product GapONSITE INTERVIEW · Seen Oct 2026
  • Minimum Nonadjacent Flips for an Alternating Binary StringONSITE INTERVIEW · Seen Oct 2026
  • Tenth-Highest Distinct SalaryONSITE INTERVIEW · Seen Oct 2026
  • Assign Cookies With Matching ParityONSITE INTERVIEW · Seen Sep 2026
  • Count Equal Code Pairs Within Distance KONSITE INTERVIEW · Seen Sep 2026
  • Daily Successful Transactions Per DepartmentONSITE INTERVIEW · Seen Sep 2026
  • Detect Substring In Any RotationONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • 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
  • New-User Devices That Opened an AppMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
All Infosys interview questionsSee Infosys hiring insights