Database search

jakeblu

Suspended / Banned
Messages
10,874
Name
Steve
Edit My Images
Yes
Any one on here knowledgable about using boolean operators in a database search. Specifically is this a correct term

......NOT (physical OR exercise OR dementia OR alzheimer)

There are a group of search conditions before this but I wanted to exclude any papers that referenced any of those subjects.

Thanks in advance for any help
 
Well, it might be logically sound, but it's impossible to say whether it's syntactically correct without knowing what kind of database it is.

It's also impossible to say whether it will have the correct effect without understanding some of the context. For example what would:
... NOT physical
do? Would it exclude all papers that contain the word 'physical' in the title? In the abstract? Anywhere in the paper? Or what?
 
Last edited:
That would usually specify any paper that didn't have ALL of those words in it. For not any it would get pretty complicated unless you can use IN.
 
Many querly languages have an IN operator

$var NOT IN ('a', 'b', 'c')

If not, you might have to write it something like:

$var NOT EQUAL TO 'a' AND
$var NOT EQUAL TO 'b' AND
$var NOT EQUAL TO 'c'


Surely that would be

......NOT (physical AND exercise AND dementia AND alzheimer)

I don't think this would work because you are saying

$var EQUAL TO ('a' AND 'b' AND 'c') and then inverting it with the NOT.
It's not possible for $var to equal 'a', 'b' and 'c' at the same time.

Depending on the query language, the operators could be anything,

e.g. EQ, ==, EQUALS, -eq etc. etc. so it's impossible to comment on whether or not what any of us suggested is valid.
 
.... it's impossible to comment on whether or not what any of us suggested is valid.
Indeed. We don't know what the database is, and we don't know how the syntax works. We're wasting our time here until the OP gets back to us.
 
Yeah sorry for being so vague, I think the database is Academic Search Complete The database does use the boolean operators NOT AND OR and the wildcard * you can group similar words or meanings within parenthesis, so for instance you can have

AND (elderly or aged) and if you put the phrase within quotation marks such as

NOT "physical exercise" then it will only exclude that exact phrase and not physical or exercise on its own.

It was just the nature of the line

NOT (physical OR exercise OR dementia OR alzheimer) that concerned me.

I was uncertain if you could bunch so many together and even if, because they were all OR, there was a short cut. Unfortunately with my limited knowledge of databases I didnt realise syntax could be different.
 
Last edited:
Well, it might be logically sound, but it's impossible to say whether it's syntactically correct without knowing what kind of database it is.

It's also impossible to say whether it will have the correct effect without understanding some of the context. For example what would:
... NOT physical
do? Would it exclude all papers that contain the word 'physical' in the title? In the abstract? Anywhere in the paper? Or what?
Basically you could limit the search to certain fields such as abstract, title, keywords etc. I just used the whole text. So in this instance, it would exclude all papers that had the word physical in them. I later modified this to NOT "physical exercise"
 
I was uncertain if you could bunch so many together and even if, because they were all OR, there was a short cut. Unfortunately with my limited knowledge of databases I didnt realise syntax could be different.

the answer is... Try it and see ... Should be easy enough in a controlled temp database where you know the exact content of the tables and can then confirm the results..

As for the amount of OR ..well that shouldn't matter .. the only way to shorten it I am guessing is to use an ARRAY .. That depends more on what your using to access the database rather than the database itself I would think
 
Last edited:
It was just the nature of the line

NOT (physical OR exercise OR dementia OR alzheimer) that concerned me.

I was uncertain if you could bunch so many together and even if, because they were all OR, there was a short cut.

NOT (x OR y) = (NOT x) AND (NOT y)
 
Dredging up my ancient search engine knowledge here, but the OP is correct - NOT ( a OR b OR c ) excludes any of a,b,c.
 
De Morgan, innit?
Crikey, it's a long while I since heard that name mentioned in casual conversation.

In a similar vein (bear with me...) at home we've had some major building work done and we're currently waiting for the concrete screed slab to dry out before we can have the flooring laid. I had thought the rule of thumb was that it dries at 1mm per day, and it's 100mm thick, and 100 days from when it was laid is... the day after tomorrow. But no, says the man from the carpet shop, it's only 1mm per day for the first 50mm, then it drops to 0.5mm per day. To which one of my friends observed that after the next 25mm it probably drops to 0.25mm per day, and then after the next 12.5mm it drops to 0.125mm per day... But it's my own fault for shopping at Zeno's Carpet Emporium.
 
If you use De Morgan's law, you can see that what you've written is

(NOT physical) AND (NOT exercise) AND (NOT dementia) AND (NOT alzheimer)

Which seems to match what you want.
 
Back
Top