Skip to Main Content

Boolean Searching: How to Write Boolean Expressions

Using the Search Operators AND, OR, and NOT

Tip: Use capital letters for AND, OR, NOT.  Not all databases require it, but some do.

Using Parentheses 1


Boolean statements may be combined into a single search string. Parentheses are used to "nest" one Boolean expression within another and thereby govern the order in which the operations take place. In the following example,

    sports AND injuries OR accidents
   (sports AND injuries) OR accidents

diagram of the expressions sports AND injuries OR accidents

the expressions are identical: "sports" AND "injuries" are combined first, and the resulting set is combined with "accidents". In each case the number of documents in the result list is the same.

Using Parentheses 2

In the expression

     (injuries OR accidents) AND sports

the words within the parentheses, "injuries" and "accidents," are combined using the operator OR, and then combined with "sports" using AND. The expression

     sports AND (injuries OR accidents)

is equivalent, and would find the same number of documents as number 3.

diagram of (injuries OR accidents) AND sports

 

Using Parentheses 3

The expression

     (sports and injuries) OR (sports AND accidents)

is equivalent to the searches in box 2, because all the articles must contain the key word "sports." In the first two expressions, only the articles which contain the word "injuries" must contain "sports". The list resulting from number 1 (or number 2) also contains all the articles including the word "accidents," whether or not "sports" appears.

Using AND, OR and NOT in Article Database Searches