What does the term "Logical operator" mean?

A type of operator which combines multiple statements.

For example, you have the attributes ‘cat’ and ‘dog’: if a person likes cats you’d set the value of that attribute to ‘yes’, and if they did not you’d set the value to ‘no’, and the same goes for dogs.

If you used an operator of AND, saying that cat = yes AND dog = yes you’d be specifying records that matched people who like cats and also like dogs, but not people who only like cats or only like dogs – they must like both types of pet.

If instead you used an operator of OR, saying cat = yes OR dog = yes you’d be specifying records where people like cats or people like dogs, which includes people who:

  • like both cats and dogs,
  • people who only like cats,
  • and people who only like dogs.
OperatorExampleDescription
& (AND)cat = yes & dog = yesPeople who like cats AND like dogs
| (OR)cat = yes | dog = yesPeople who like cats OR dogs including:

 

  • like both cats and dogs,
  • people who only like cats,
  • and people who only like dogs.
~ (NOT)cat = yes ~ dog = yesPeople who like cats but do not like dogs
^ (XOR)cat = yes ^ dog = yesPeople who:

 

  • do not like cats
  • do not like dogs

Leave a Reply

Thank you for choosing to leave a comment. Comments may be moderated.