How To Compare 2 Tables In Sql?
I am working on SQL as part of a school project I am making. The front end is Java netbeans. I have two tables and I want to compare them and confirm that they have no similar records. How to compare 2 tables in sql?
I am working on SQL as part of a school project I am making. The front end is Java netbeans. I have two tables and I want to compare them and confirm that they have no similar records. How to compare 2 tables in sql?
SQL is a very diverse software. I think whenever you are programming, you should refer the website called “stackoverflow”. It will address your basic queries and also advanced ones. For your current query, to compare two sql tables, you should use the minus function. (may also be called the ‘except’ function)
The syntax is this:
select * from table1 minus select * from table2
If it returns no results, that means there are no similar records. If it returns, then delete those records from any one table.