code for checking data and implementing integrity constraints