How to use logical operators (AND OR NOT) in SQL