Skip to main content

Except

SQL

Use the Except gem to extract rows that are present in the first table but absent from all subsequent tables. This is useful for identifying gaps, such as missing orders, unprocessed records, or customers who haven’t returned.

Input and Output

PortDescription
in0The primary input table.
in1The second input table. Any matching rows from in0 will be excluded from the output.
inNOptional: Additional input tables. Matching rows from in0 will be excluded from the output.
outA table containing rows from in0 that do not appear in any other input.

To add additional input ports, click + next to Ports.

All input tables must have identical schemas (matching column names and data types).

Parameters

ParameterDescription
Operation TypeShows that the set operation type is Except
Preserve duplicate rowsCheckbox to keep duplicates in the output table

Example

Let’s say you’re working with two tables: Table A and Table B.

  • Both tables contain order-related data.
  • Table A contains order information from customer 1, 2, and 3.
  • Table B contains order information from customer 1, 2, 3, and 4.
  • These tables contain some identical records (duplicates).

Table A

order_idcustomer_idorder_dateamount
10112024-12-01250.00
10222024-12-03150.00
10312025-01-15300.00
10432025-02-10200.00

Table B

order_idcustomer_idorder_dateamount
10312025-01-15300.00
10432025-02-10200.00
10542025-03-05400.00
10622025-03-07180.00

Result

The table that results from the Except gem only includes records in Table A that are not in Table B.

order_idcustomer_idorder_dateamount
10112024-12-01250.00
10222024-12-03150.00

The output indicates that order 101 and 102 appear in Table A, but not in Table B.