FastPrepCount Records Present in A but Not B

Count Records Present in A but Not B

Capital One logoCapital One● EasyFULLTIMEPHONE SCREEN

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.

TableColumnDescription
records_arecord_idIdentifiers in the first dataset.
records_brecord_idIdentifiers 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.

ColumnTypeNullableDescription
record_idPKIntegerNoA record identifier in the first dataset.

records_b

One row per unique identifier in the second dataset.

ColumnTypeNullableDescription
record_idPKIntegerNoA record identifier in the second dataset.

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
record_countIntegerNoThe 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 0 and 100000 rows.
  • Every record_id is a non-null integer.
  • Each record_id is unique within its table.
  • The result always contains exactly one row, including when the count is 0.

More Capital One problems

See Capital One hiring insights