sql query to compare two tables and find records with matches code example Example: sql compare data from two tables select * from tableA minus select * from tableB