We can compare data from two tables of DB2 tables using the below simple query,
Step 1:- Select which all columns we need to compare from table (T1) of schema(S)
SELECT T1.col1,T1.col3,T1.col5 from S.T1
Step 2:- Use 'Minus' keyword for comparing 2 tables.
Step 3:- Select which all columns we need to compare from table (T2) of schema(S)
SELECT T2.col1,T2.col3,T2.col5 from S.T1
END result:
SELECT T1.col1,T1.col3,T1.col5 from S.T1
MINUS
SELECT T2.col1,T2.col3,T2.col5 from S.T1;
If the query returns no rows then the data is exactly the same.