Database applications
Relational databases use SQL, or other database-specific languages, to perform queries, which may contain Boolean logic. For this application, each record in a table may be considered to be an "element" of a "set". For example, in SQL, these SELECT statements are used to retrieve data from tables in the database:
SELECT * FROM EMPLOYEES WHERE LAST_NAME = 'Smith' AND FIRST_NAME = 'John' ;
SELECT * FROM EMPLOYEES WHERE LAST_NAME = 'Smith' OR FIRST_NAME = 'John' ;
SELECT * FROM EMPLOYEES WHERE NOT LAST_NAME = 'Smith' ;
Parentheses may be used to explicitly specify the order in which Boolean operations occur, when multiple operations are present:
SELECT * FROM EMPLOYEES WHERE (NOT LAST_NAME = 'Smith') AND (FIRST_NAME = 'John' OR FIRST_NAME = 'Mary') ;
Multiple sets of nested parentheses may also be used, where needed.
Any Boolean operation (or operations) which combines two (or more) tables together is referred to as a join, in relational database terminology.
In the field of Electronic Medical Records, some software applications use Boolean logic to query their patient databases, in what has been named Concept Processing technology.
[edit] Search engine queries
Search engine queries also employ Boolean logic. For this application, each web page on the Internet may be considered to be an "element" of a "set". The following examples use a syntax supported by Google.[3]
- Doublequotes are used to combine whitespace-separated words into a single search term.[4]
- Whitespace is used to specify logical AND, as it is the default operator for joining search terms:
"Search term 1" "Search term 2"
- The OR keyword is used for logical OR:
"Search term 1" OR "Search term 2"
- The minus sign is used for logical NOT (AND NOT):
"Search term 1" -"Search term 2"
|