[sql] Is this the proper way to do boolean test in SQL?