Comparison keys uniquely identify every single row in a table or a view for both the Source and Target.
When comparing data sources, Data Compare for MySQL uses a matching primary key or other unique identifiers in each data source as the comparison key. This enables rows to be identified as matching and then compared.
Consider the following example. The databases products and orders each contain the UnitPrice table.
As rows can be inserted and deleted, you can’t be sure that the fifth row in the products database is the same as the fifth row in the orders database. So if you simply compare rows in the order in which they appear in the table, it can result in a meaningless comparison. In a similar way, rows can’t be matched based on their UnitPrice values, as more than one unit can have the same price.
In the UnitPrice table, Product_id is a primary key. No two units can have the same Product_id, and thus the rows are uniquely identified. Two matching Product_id values in products and orders, therefore, represent the same piece of real-world data.
Note
If there’s no matching primary key or another unique identifier you need to set an appropriate comparison key when selecting tables and views for comparison. For example, if you know that two units with the same name are never added to the database on the same day, you can select the two columns UnitName and Date to form the comparison key.