Count Records Present in A but Not B
Updated
Problem statement
The records_a and records_b tables each contain one row per unique record identifier.
Return one row containing the number of identifiers that appear in records_a but do not appear in records_b. Name the output column record_count.
| Table | Column | Description |
|---|---|---|
records_a | record_id | Identifiers in the first dataset. |
records_b | record_id | Identifiers in the second dataset. |
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.
records_a
One row per unique identifier in the first dataset.
| Column | Type | Nullable | Description |
|---|---|---|---|
| record_idPK | Integer | No | A record identifier in the first dataset. |
records_b
One row per unique identifier in the second dataset.
| Column | Type | Nullable | Description |
|---|---|---|---|
| record_idPK | Integer | No | A record identifier in the second dataset. |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| record_count | Integer | No | The number of identifiers in records_a that are absent from records_b. |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
- Each table contains between
0and100000rows. - Every
record_idis a non-null integer. - Each
record_idis unique within its table. - The result always contains exactly one row, including when the count is
0.
More Capital One interview questions
- LRU CachePHONE SCREEN · ONSITE INTERVIEW · Seen May 2026
- Maximum Subarray SumPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2025
- Ten-Pin Bowling Frame ScoresPHONE SCREEN · Seen Nov 2023
- Min StackPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2023
- Invert a Binary TreePHONE SCREEN · Seen Dec 2020
- Count How Often a Word Appears in a ParagraphPHONE SCREEN
- In-Memory File System With Directory SizesPHONE SCREEN · ONSITE INTERVIEW
- Pick the K Nearest Grid Points to (0, 0)PHONE SCREEN · ONSITE INTERVIEW
- The Nth Number in the Fibonacci SequencePHONE SCREEN · ONSITE INTERVIEW
- Count Pairs of Overlapping SquaresOA · Seen Nov 2026
Similar questions at other companies
- Second Highest SalaryPaytm · PHONE SCREENPaytm interview questions
- Employees Who Earn More Than Their ManagersNykaa · PHONE SCREENNykaa interview questions
- Employees Who Joined More Than a Week AgoNewgen Software · PHONE SCREEN
- Departments Without EmployeesDell Technologies · PHONE SCREENDell Technologies interview questions
- Second-Highest Distinct SalaryChubb · PHONE SCREENChubb interview questions
- Swap Two Gender ValuesInfosys · PHONE SCREENInfosys interview questions
- Find Rows Common to Two TablesSalesforce · PHONE SCREENSalesforce interview questions
- Customer Order Count Distribution by CountryApple · PHONE SCREENApple interview questions
- Employees Earning More Than Their ManagerMygate · PHONE SCREENMygate interview questions
- Classify Tree Nodes with SQLOracle · PHONE SCREENOracle interview questions
Capital One interview experiences
- Capital One Coding OA Questions: 3 Experiences
- Capital One Experienced Engineer Power Day and OA: 6 Experiences
- Capital One New Grad OA Questions: 14 Experiences (Part 2 of 2)
- Capital One TDP Agentic Round (AI Coding): 7 Experiences
- Capital One SWE Power Day, Level Not Reported: 6 Experiences
- Capital One TIP Intern OA and Power Day: 13 Experiences