• we are asked to make a report that show all the students with

    these conditions:

    if the student has a score='a' then sex must be 'f' .

    if the student has a score='b' then courseTaken must be greater than 7.

    I think this is an unclear method of stating a business requirement. If I were to receive this as my requirements with a request for all rows that violate this rule, I would write;

    SELECT id, sex, grade, courseTaken
    FROM #stu
    WHERE
        (grade = 'a' AND sex != 'f') -------- those that fail the first condition
     OR (grade = 'b' AND courseTaken <= 7) -- those that fail the second condition
    

    (~P | Q) for the first rule would read

    "IF the student does not have a score of 'a' THEN sex may or may not be 'f'"

    And those that satisfy this test (anyone with out a grade of 'a') are not in violation of the original first rule. They are in compliance by implication. The issue is, that the only way the rule can be broken is if the condition is met and the expectation is not met. If the condition is not met, then there is no expectation...