Left anti join results in rows from only statesPopulationDF if, and only if, there is NO corresponding row in statesTaxRatesDF.
![](/api/v2/epubs/9781785280849/files/assets/2a630114-9df6-4b48-9607-5be5c27a832b.png)
Join the two datasets by the State column as follows:
val joinDF = statesPopulationDF.join(statesTaxRatesDF, statesPopulationDF("State") === statesTaxRatesDF("State"), "leftanti")%sqlval joinDF = spark.sql("SELECT * FROM statesPopulationDF LEFT ANTI JOIN statesTaxRatesDF ON statesPopulationDF.State = statesTaxRatesDF.State")scala> joinDF.countres22: Long = 28scala> joinDF.show(5)+--------+----+----------+| State|Year|Population|+--------+----+----------+| Alaska|2010| 714031||Delaware|2010| 899816| ...