Compare two db table entries

After executing a test case, I have to compare a table in two databases.
I will have a database with the expected output and will use another database for testing.

How can I achieve this?

it depends on what DB are you using. some of them have buil-in functions (Oracle, partialy MS SQL) but usually you can create nice SQL select to copare 2 tables look at this example for postgresql:
http://www.postgresqltutorial.com/compare-two-tables-in-postgresql/
i think it’s quite universal example