Why are there two different comparison operators that seem to do the same thing.
Is there any situation where one would be prefered over the other?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
<= and > are comparison operators, not logical operators. ! is a logical operator (means NOT). When you combine ! and >, you’re simply inverting a comparison operator, so your end result is the same.
Having said that, <= is the common form, so I’d say it’s preferred, for readability if nothing else. I don’t know if there’s a performance benefit to either, but I doubt it.
Edit:
Also, you didn’t say which flavor of SQL you’re dealing with. As @harryovers pointed out, that’s a valid operator in MS-SQL, but it might not work everywhere.