• SQLUSERMAN (12/10/2016)


    Suppose I want to find customers in the customers table who are not in the US or the UK.

    To me the query for the above requirements would be as follows:

    Select * from customers where country != 'US' AND country !='UK';

    However, I've seen people write the query for the above requirements as follows:

    Select * from customers where Not(country = 'US' OR ='UK');

    Please explain which one is correct, thanks.

    Generally, if it works then its "correct" but in this case you should just simplify the query and use NOT IN

    😎

    where country NOT IN ('US','UK');