Below, we explain how to use Boolean operators in searches. Please read on for examples of how Boolean operators work.
Definition: Boolean operators
Boolean operators are logical connector words such as ‘and‘, ‘or‘, and ‘not‘. They make database searches more precise and save time by removing unsuitable results. These searches use Boolean strings, i.e., keywords joined with one or more logical operators.
Boolean operators and how to use them
Using Boolean operators can significantly reduce or expand the number of records returned. The targeted results save time. Apart from research, the technique is valuable in investigation and reviews.
|AND||Requires both keywords||'Vaccines in (Europe AND Asia)'
- selects results with both
|OR||Requires one or more terms||'Vaccines in (Europe OR Asia)'
- generates more results, selecting either continent.
|Parentheses ()||Evaluates parenthesized terms first||'(Smoking or vaping) and arteries'
|NOT & AND NOT||Exclude specified term(s)||'Mexico AND NOT city'
|Asterisk *||Look for alternative endings||'electr*'|
Boolean Operator AND
Boolean Operator ‘AND‘ obtains results with two or more keywords. Both terms are in each result, so it narrows database searches. Thus, ‘dogs AND service animals’ would return information about guide dogs and police dogs, but not pet animals.
Boolean Operator OR
Boolean Operator ‘OR‘ returns at least one of the keywords, so it broadens a database search. ‘Ecology OR pollution’ would find results containing ecology (though not pollution), pollution (but not ecology), and both words in either order.
Boolean Operator Quotation Marks: ” “
Quotation marks specify the exact keywords contained within them. The search is more precise; results must include the phrase as a whole, i.e. the words together and in order. Searching for wild animals (without quotation marks) yields results with either word and both separately. In contrast, searching for “wild animals” returns articles with that exact phrase.
Boolean Operator Asterisk: *
We use the asterisk symbol to truncate a search word. The results contain variations of a root word.
Use the asterisk to find results that contain the keyword you entered and other words that begin with those letters. For instance, electr* would return for electronics, electrical, electricity, electrify, electrode, etc.
You can also use an asterisk at the beginning of a word. Results using ‘*electr*’ would also include hydroelectric, microelectronics, etc.
Boolean Operator Parentheses: ( )
Parentheses group keywords together. Database queries and search engines evaluate parenthesized Boolean expressions first, thus customizing the results.
In the above example, ‘(smoking or vaping) and arteries’ returns results containing: ‘smoking and arteries’, ‘vaping and arteries’, and ‘smoking, vaping & arteries’. However, it does not return ‘smoking or vaping’ when the word ‘arteries’ is absent.
More than one parenthesis is possible. Imagine you are looking for medicines or medical interventions for seizures and convulsions other than those due to epilepsy. The following search contains multiple parentheses and all the Boolean operators:
How Boolean operators are used in databases
Search engines and database systems use Boolean operators slightly differently. They may require capitalized operators or use special punctuation.
Google’s advanced options increase accuracy by fine-tuning the keyword search.
- We use’+‘ for AND operations, so ‘World War +2’ would focus results on the Second World War.
- Conversely, we use the minus symbol ‘–‘ instead of NOT to exclude undesired keywords.
Computer programming languages also use Boolean operators.
Finally, we use proximity operators to filter database searches based on the proximity of one keyword to another. This technique increases the relevance of results.
The three proximity operators and their functions are:
|NEAR (Nx)||Results contain your chosen keywords within x words of each other, irrespective of sequence.||'Renewable N4 energy' searches for 'energy' appears within four words of 'renewable'.
Results might include 'renewable energy sources' and 'energy from environmentally friendly, renewable sources'.
|WITHIN (Wx)||Results contain your keywords within x words of each other, in the specified order.||'Renewable W4 energy' searches for 'energy' within four words after 'renewable'.
Results might include 'renewable and reliable energy sources' – but not 'energy from renewable sources' due to the reverse order.
|SENTENCE||Lists sentences in which two or more specified keywords occur.||'Research SENTENCE skills'
Lists sentences containing the words ‘research' and 'skills', such as 'This research covers the acquisition of second language skills.’
Boolean operators are simple words used as conjunctions to combine or exclude keywords in a search, resulting in better-focused results.3
Boolean operators do both. Using ‘OR‘ usually widens results, whereas ‘AND‘ does the opposite.
Simpler queries use few Boolean operators, but you can use several for detailed searches with multiple conditions. Some search engine fields, query input lines, or programming language statements limit the number of characters.
This choice depends on whether you want any of the terms in the results or all of them.
An asterisk truncates a search word. The results contain any alternate endings found. Note: in Boolean searches, ‘*’ is not a multiplication symbol, unlike some programming languages.
1 Austlii. “Boolean Operators Chart.” Accessed November 11, 2022. http://www.austlii.edu.au/worldlii/help/boolean.html.
2 Suny Empire. “Research Skills Tutorial.” Accessed November 11, 2022. https://subjectguides.esc.edu/researchskillstutorial/boolean.
3 Value Exchange. “Why You Should Use Booleon Operators.” Accessed November 11, 2022. https://www.linkedintraining.co.uk/strategy/why-use-boolean-operators/.