sql constraint instead of condition