Those are three radically different questions. Data redundancy means you're checking for duplication. In order to make that check, you need to determine what signifies a duplicate within the table to which you are referring. There's not a single query that will satisfy until you can define what makes a duplicate record.
To check for integrity is much easier. If you have proper primary and foreign keys in place prior to the data load, these will ensure data integrity, that's what they're meant to do. But if you don't have them, you simply need to query parent table to child table to ensure that any given child record has an associated parent record. Again, you'll need to define what represents a key up front (or an alternate key) and that depends on the needs of your system.
Finally data consistency is completely a business model. There is no way from a pure programming stand point to know that, for example, 'NY' and 'New York' are either incorrect or correct values for a given field unless someone has defined that the data must look a certain way. This is apart from the defintions within data integrity, but can actually be enforced through those means.
In short, you really need to define which of these questions you're trying to answer and specifically where within your own system you're having issues.
answered Mar 25 '10 at 09:21 AM
Grant Fritchey ♦♦
It depends on your data really. Do you have a specific problem you're stuck on?
answered Mar 25 '10 at 04:37 AM