Boolean Search Operators: AND, OR, NOT With a Worked Example
Boolean search operators are the words AND, OR and NOT, which tell a database how to combine search terms. AND narrows a search, OR widens it and NOT removes records. Parentheses group terms, truncation catches word endings and proximity operators set how close words must sit, all of which a literature search needs.
This page shows what each operator does, how nesting, truncation and proximity change the records you retrieve, and how to carry one search from database to database. It sits inside the wider field of research methodology, builds on the question blocks from the PICO framework page and supports your literature search strategy. The example is invented and was computed in code on a small test database, so every number can be traced.
On This Page
- Boolean Search Operators Explained Simply
- What Are Boolean Search Operators?
- What Do AND, OR and NOT Do?
- How Does Nesting With Parentheses Work?
- Truncation and Wildcards
- Phrase Searching and Proximity Operators
- Application of Boolean Operators: a Worked Example
- How Does the Syntax Change Between Databases?
- Advantages and Limitations of Boolean Searching
- Common Mistakes With Boolean Operators
- Boolean Searching in Business Research
- Boolean Searching in the Age of AI and Digital Research
- When to Use Each Operator
- Dissertation Example
- Exam Tip
- References
The table below summarises the main tools in one view.
| Tool | Effect on results | Typical symbol or form |
|---|---|---|
| AND | Narrows: records must contain every term | peer AND mentoring |
| OR | Widens: records may contain any term | retention OR persistence |
| NOT | Removes records containing a term, with risk | mentoring NOT online |
| Parentheses | Control the order in which operators work | (a OR b) AND c |
| Truncation | Finds different endings of a word | mentor* |
| Phrase marks | Find words together in order | “peer mentoring” |
| Proximity | Find words within a set distance | peer N3 mentor*, varies by database |
Boolean Search Operators Explained Simply
Imagine sorting a box of index cards. AND is a rule that says keep only cards that carry both labels. OR says keep a card if it carries either label. NOT says throw away any card with a particular label, even if it also carries a label you wanted. A database follows these rules at high speed, so the rules you type decide which cards you ever see.
The surprise for most students is that the operators are blunt. They do not understand meaning. They match the characters you typed, so the quality of your search depends on the words you choose and how you combine them.
What Are Boolean Search Operators?
Boolean operators take their name from George Boole, whose nineteenth-century logic combined true and false statements. In a library database the same logic combines sets of records. Each search term finds a set of records; AND keeps the overlap of two sets, OR joins them and NOT subtracts one from the other. A literature search strategy is made of many of these set operations, built carefully and recorded so that someone else can repeat them.
Repeatability matters because published reviews are expected to report the search in enough detail for others to replicate it. One review of search strategy formulation notes that search strategies should be published, for example as an appendix, and be fully replicable by third parties, and it describes the methods for constructing them as complex, time consuming and error prone. That is the reason to learn the operators properly. Your searches feed the systematic literature review process, the screening counts in a PRISMA flow diagram and the methods section of any systematic review protocol.
Boolean operators are also not the only way databases retrieve records. Many databases rank results by relevance, suggest subject headings and apply their own mapping to what you type. Boolean searching is the part you control exactly, which is why reviews rely on it.
What Do AND, OR and NOT Do?
The effect of each operator is easiest to see on a test database. The example on this page uses 40 invented records about peer mentoring and first-year retention, where 20 records are marked as truly relevant to the question. The records, the terms and the counts are made up, and every figure was computed in code. The intention is to show how the logic behaves, not to describe any real database.
AND joins different ideas. Searching peer AND mentor* retrieves 15 records, of which 11 are relevant, compared with 31 for mentor* alone. Each extra AND removes records that lack the new idea. Use AND between concepts, never between synonyms, because a record that uses only one of two synonyms would be lost.
OR joins alternatives for the same idea. Retention OR persistence OR dropout OR attrition catches records that describe the same outcome in different words. Every extra OR adds records, so it raises the number to screen but lowers the risk of missing something. Use OR between synonyms, spelling variants and related terms inside one block.
NOT removes records that contain a word. In the test database, the full search line retrieved 22 records, and adding NOT online removed 1 record, which was a relevant study of online mentoring of first-year undergraduates. Recall fell from 90 to 85 per cent. NOT cannot tell whether the excluded word is the main topic or a passing mention, so it can delete records you wanted. A review of search strategy formulation also warns that NOT can be misread because some interfaces implement it as AND NOT. Most review guides advise using it sparingly, and only with a reason you can state in the methods.
How Does Nesting With Parentheses Work?
Nesting means placing a group of terms inside parentheses so that the database treats the group as a unit. The standard pattern is one parenthesised block of OR-joined synonyms for each idea, with the blocks joined by AND. The PICO framework page shows how to turn a question into those blocks; this page shows what goes wrong without the parentheses.
Databases do not all read an unbracketed line the same way. Some university guides say that databases generally process AND before OR and NOT and work left to right, while an older National Library of Medicine tutorial describes PubMed processing connectors left to right unless you nest. Whatever the rule, the safe habit is the same: put every OR-block in parentheses so that the line has only one possible reading.
The test database shows the cost. The line “first year” AND mentor* AND retention OR persistence, read with AND before OR, retrieves 12 records, because persistence now stands alone and brings in every record containing it. Only 9 of those 12 are relevant, so 3 are noise. The intended line “first year” AND mentor* AND (retention OR persistence) retrieves 8 records, of which 7 are relevant, leaving 1 irrelevant. The same words give two different searches, and only the parentheses decide which one runs.
Figure 1 shows the full nested line used in the worked example: three OR-blocks, each in parentheses, joined by AND. The population block matched 28 of the 40 records, the intervention block 33 and the outcome block 29, and the combined line retrieved 22.

Truncation and Wildcards
Truncation replaces the end of a word with a symbol, usually an asterisk, so that one entry finds several forms. In the test database, mentor* matched 5 word forms: mentor, mentored, mentoring, mentors, mentorship. That one entry retrieved 31 records and 95 per cent of the relevant ones, while the single form mentoring retrieved 23 and 60 per cent.
Wildcards replace characters inside a word, for example one symbol for the difference between American and British spellings. They are less standard than truncation, and the symbol changes between databases, as the table in a later section shows. Choose the stem carefully. A stem that is too short brings in unrelated words, and one that is too long misses endings. Check the list of word forms the stem would match before relying on it.
PubMed behaves differently from most databases. Several library guides explain that using truncation, like using quotation marks, switches off PubMed’s automatic term mapping, so subject headings are no longer applied to the term automatically. One college guide also states that the stem needs at least four characters before the asterisk, and that in a phrase the truncated word must come last. Where this applies, supplement truncated terms with the subject headings and spelled-out variants yourself.
Phrase Searching and Proximity Operators
A phrase in quotation marks finds the words together and in order. It is precise but strict. In the test database, “peer mentoring” retrieved 8 records and only 30 per cent of the relevant ones, because authors also write mentoring by peers, peer-led mentoring or peer mentors.
Proximity operators loosen a phrase by allowing other words in between. A search for peer within five words of mentor* retrieved 13 records, with 11 relevant. Requiring the words to be adjacent retrieved 12, with 10 relevant, and widening to six words between them let in 14, adding an irrelevant record in which the two words had little to do with each other. Plain AND, which ignores distance, retrieved 15. Proximity therefore sits between a phrase and AND: more tolerant than the first, more precise than the second.
Proximity syntax is where databases differ most. Symbols differ, and so can the counting rule. In Ovid, ADJn allows up to n minus one words between the terms, while Web of Science NEAR/n allows n words between them. A review of search strategy formulation reports that NEAR/5 in Web of Science means a maximum of five words between the terms, while the same expression in Embase means a maximum of four. The same number may therefore not retrieve the same records, so check the help page of each database before you translate a line.
Application of Boolean Operators: a Worked Example
The example below is invented to show the method. It does not describe a real review. The question is whether peer mentoring improves first-year undergraduate retention. The test database holds 40 records, 20 of them truly relevant. Each search below was computed in code, and the table shows how many records it retrieved, how many of those were relevant, the share of retrieved records that were relevant (precision) and the share of all relevant records found (recall).
| Search | Search line | Records retrieved | Relevant | Precision | Recall |
|---|---|---|---|---|---|
| 1 | mentoring | 23 | 12 | 52.2% | 60.0% |
| 2 | mentor* | 31 | 19 | 61.3% | 95.0% |
| 3 | peer AND mentor* | 15 | 11 | 73.3% | 55.0% |
| 4 | "peer mentoring" (phrase) | 8 | 6 | 75.0% | 30.0% |
| 5 | peer NEAR/3 mentor* | 13 | 11 | 84.6% | 55.0% |
| 6 | Three blocks joined by AND | 22 | 18 | 81.8% | 90.0% |
| 7 | Line 6 NOT online | 21 | 17 | 81.0% | 85.0% |
Three lessons stand out. Truncation raised recall from 60 to 95 per cent and, here, precision too (52.2 to 61.3 per cent), because the extra word forms were mostly relevant; that is not guaranteed in a real database. The three-block line (search 6) reached 90 per cent recall with 81.8 per cent precision, the best balance of the seven, because each block did a different job. Finally, NOT online (search 7) lowered both recall (90 to 85 per cent) and precision (81.8 to 81.0 per cent): 1 relevant record was lost and no irrelevant record was removed.
The line still missed 2 relevant records, because one described retention as enrolment in the second year and the other described it through belonging and peer networks. No operator can find a word you did not search. This is why building the synonym list from known key papers matters, and why a pilot run of the search is worth the time (see pilot study).
How Does the Syntax Change Between Databases?
The logic of AND, OR and NOT is the same everywhere, but the symbols for truncation, wildcards and proximity are not. The table below follows a university library guide to advanced searching; confirm any entry in the help pages of the platform you use, because interfaces change.
| Database or platform | Truncation and wildcards | Proximity |
|---|---|---|
| Scopus | * for truncation; ? replaces exactly one character | W/n: n words between, any order; Pre/n: n words, order fixed |
| Web of Science | * matches any group of characters including none; ? one character; $ zero or one | NEAR/n: n words between |
| Ovid (Medline, Embase, PsycINFO) | * or $ for truncation; # exactly one character; ? zero or one | ADJn: up to n minus one words between, any order |
| EBSCO (CINAHL, ERIC) | * for truncation; ? one character; # zero or one | Nn: within n words, any order; Wn: in the order entered |
| PubMed | * for truncation, with the limits described above | A phrase with a tilde distance, for example “peer mentoring”[tiab:~3], limited to two words |
To carry one idea across platforms, translate it term by term. The intention peer within three words of mentor can be written as peer W/3 mentor* in Scopus, peer NEAR/3 mentor* in Web of Science and peer N3 mentor* in EBSCO. In Ovid you would need ADJ4 to allow three words between, under the rule above. In PubMed, where one guide states that proximity is ignored if truncation is applied, you would list the forms, for example “peer mentoring”[tiab:~3] OR “peer mentor”[tiab:~3] OR “peer mentors”[tiab:~3]. Record every translated line, with the date and the number of records, in your search log so it can feed the screening counts in your PRISMA flow diagram.
Keep the logic constant and change only the syntax. If the number of records from one database is far larger or smaller than expected, check parentheses, truncation symbols and field settings first. Your literature review sources choices decide which databases you translate into.
Advantages and Limitations of Boolean Searching
The strength of Boolean searching is control. You can state exactly what the search does, repeat it, publish it and rerun it later to update a review. It is also supported by almost every academic database, so one skill transfers across them. For a systematic literature review or a rapid review, that transparency is the point.
Its limits are equally clear. It matches words, not meaning, so it misses records that use different vocabulary, as the two missed records show. It treats every matching record as equal, with no ranking by relevance. And a long, carefully built line can still give a false sense of completeness. Combine it with subject headings where the database offers them, with checks against known key papers, and with citation searching, so that the search does not depend on the words in your head alone.
Common Mistakes With Boolean Operators
Most mistakes are cheap to avoid and expensive to ignore. The table prices five of them in the invented test database.
| Mistake | What happens | Cost |
|---|---|---|
| Using NOT to exclude a word | NOT online removes 1 record from the 22 retrieved | Recall falls from 90 to 85 per cent, because the deleted record was relevant |
| Leaving out parentheses | 12 records retrieved instead of 8 when OR sits beside AND | 3 irrelevant records instead of 1 |
| Searching one word form, mentoring | 23 records retrieved | Recall 60 per cent, against 95 per cent for mentor* |
| Relying on an exact phrase only | 8 records retrieved | Recall 30 per cent, so seven in ten relevant records are missed |
| Setting proximity too tight | 12 records with words adjacent, 13 with up to five words between | 1 relevant record dropped when the gap is set to zero |
- Writing operators in lower case. Several library guides state that PubMed needs AND, OR and NOT in capitals to read them as operators.
- Joining synonyms with AND, which demands that every synonym appears in the same record.
- Putting different concepts in one OR-block, which breaks the logic that each block stands for one idea.
- Forgetting that truncation and quotation marks switch off PubMed’s automatic term mapping.
- Copying a line from one database into another without changing wildcards and proximity symbols.
Boolean Searching in Business Research
Business and management literatures often use several names for one practice, such as mentoring, coaching, buddying and onboarding. The OR-block for the intervention must therefore be wide. A student who searches only one label, for example flexible working, can miss papers that call the same idea remote work, hybrid work or telework.
Business databases also mix journal articles, trade press and company reports. A narrow line with NOT can remove useful reports, so it is usually better to apply source-type limits in the database interface and to screen by title and abstract. Document each choice, since a business reader will ask why practitioner sources were included or excluded.
Boolean Searching in the Age of AI and Digital Research
AI tools can draft a search line, suggest synonyms and translate syntax from one database to another. Used well, they save time on the first draft. They can also produce a line that looks correct but uses a wildcard or proximity symbol that the target database does not support, or add terms that no author uses.
Treat every AI-suggested line as a draft. Check each symbol against the database help page, run the line, read the first records and compare the count with what you expect. Report any AI assistance in your methods, together with the final line and date for each database. The Dudovskiy Research Assistant can help you explain why your search design fits your question, while the searching, screening and recording remain your work.
When to Use Each Operator
| Situation | Recommended tool |
|---|---|
| Joining different concepts | AND between OR-blocks |
| Covering synonyms and spelling variants | OR inside one block, with truncation where safe |
| Excluding a clearly irrelevant sense of a word | NOT, tested first, with the removed records read |
| Fixed expression such as a named programme | Quotation marks |
| Words that often sit near each other but vary | Proximity operator, with syntax checked per database |
| A line that mixes AND and OR | Parentheses around every OR-block |
Start wide with OR-blocks, join them with AND, then narrow only if the number of records is unmanageable. Narrowing too early removes records you cannot get back. For questions framed with the PICO framework, the blocks come directly from the question; for exploratory work, see scoping review.
Dissertation Example
Searches combined three blocks of terms with AND: population (28 matching records in the pilot test), intervention (33) and outcome (29). Within each block, synonyms were joined with OR and truncated with an asterisk, for example mentor*. Phrases were placed in quotation marks and each block was enclosed in parentheses so that the database read the line as intended. The line was run in each database using its own syntax for truncation and proximity, and the exact string, date and number of records are given in Appendix B. NOT was not used, because it can remove relevant records.
This extract is invented for illustration. Annotations: the first sentence reports the three blocks and the records each matched, so a reader can judge breadth. The second explains the use of OR and truncation. The third shows that grouping was deliberate. The fourth states that syntax was adapted per database and that the exact lines are in an appendix. The final sentence explains why NOT was avoided, which pre-empts an examiner’s question.
Exam Tip
Examiners often ask why a search was built as it was. Be ready to explain that you joined synonyms with OR, joined concepts with AND, used parentheses so the line had one reading, and avoided NOT because it can delete relevant records. Be ready also to say what your search could not find, such as records using other vocabulary. Link your answer to your literature search strategy and your systematic review protocol. For wider planning, see writing a dissertation proposal and delimitations and scope.
John Dudovskiy
Planning a literature search? The Dudovskiy Research Assistant helps you explain and justify your search design in your methodology.
References
- King’s College London Library Services (n.d.) Systematic review: advanced searching. Available at: https://libguides.kcl.ac.uk/systematicreview/advanced (Accessed: 6 December 2026).
- MacFarlane, A., Russell-Rose, T. and Shokraneh, F. (2022) ‘Search strategy formulation for systematic reviews: issues, challenges and opportunities’, Intelligent Systems with Applications, 15, article 200091. doi:10.1016/j.iswa.2022.200091.
- National Library of Medicine (n.d.) PubMed tutorial: searching, Boolean operators (archived copy). Available at: https://webarchive.library.unt.edu/eot2008/20090511055402/http:/www.nlm.nih.gov/bsd/disted/pubmedtutorial/020_390.html (Accessed: 6 December 2026).
- Royal Children’s Hospital Library (n.d.) PubMed: search, save and manage results (fact sheet 14). Available at: https://www.rch.org.au/uploadedFiles/Main/Content/rch-library/docs/fact14.pdf (Accessed: 6 December 2026).
- University of Dayton Libraries (n.d.) PubMed search tips. Available at: https://libguides.udayton.edu/database-tutorials/PubMed-search-tips (Accessed: 6 December 2026).
- HSLS LibGuides (n.d.) Using PubMed to develop searches. Available at: https://hsls.libguides.com/PubMed-search-filters/syntax (Accessed: 6 December 2026).
- New York University Health Sciences Libraries (n.d.) PubMed: an introduction, syntax. Available at: https://hslguides.med.nyu.edu/introductiontopubmedguide/syntax (Accessed: 6 December 2026).
- Red River College Polytechnic Library (n.d.) PubMed: improve your search. Available at: https://library.rrc.ca/pubmed/improve-search (Accessed: 6 December 2026).
- University of Illinois Chicago Library (n.d.) Advanced search strategies: Boolean operators. Available at: https://researchguides.uic.edu/searchstrategies/boolean (Accessed: 6 December 2026).
- University of Missouri-St. Louis Libraries (n.d.) PubMed at UMSL: basics. Available at: https://libguides.umsl.edu/pubmed/searchbasics (Accessed: 6 December 2026).
References checked against publisher, library or registry records on 6 December 2026.
Last reviewed: December 2026.
