This section will take a look at the methods used to search for data that has been stored in a database.
You will learn how to use something called 'operators' which are used to structure your searches. 
Key Concepts of this section:

#
# 
How to use 'logical operators' to structure searches
How to use 'mathematical operators' to structure searches 



What are operators? 

Key Words:

Logical Operators , Mathematical Operators 


# Operators are used when searching for data in a database.
# Operators are used to give the computer 'specific instructions' on what to search for.



Examples of commonly used operators: 






Examples of how Operators are used within Searches 

# Look at the table of Names, Genders and Heights below.
# We will use the table to show 3 examples of how logical and mathematical operators could be used to search it. 


Example 1: AND with = and > 


# If we wanted to search the table for the following data:
# (Gender = Male) AND (Height is >1.7)
# The search would bring up the following result:

NOTE!
= will find an exact match.
> means 'greater than'





Explanation! 
The search is looking for data that match BOTH parts of the criteria. For example the people in the orange cells would be returned as a result because:


Mike = Male 


Height >1.7 


Some of the other people matched one part of the criteria but not both.
Some of the people did not match any of the criteria at all.




Example 2 : OR with = and < 


# If we wanted to search the table to find a different set of data such as:
# (Gender = Female) OR (Height is <1.7)
# The search would bring up the following result:

NOTE!
= will find an exact match.
< means 'less than'





Explanation! 
This search is looking for data that match EITHER side of the criteria. The people in the orange cells would be returned as a result because: 

Salma = Female 


Height <1.7 



Robert = Female 


Height <1.7 



Karen = Female 


Height <1.7 


If EITHER side of the search is matched, the data will be returned in the result. 





# If we wanted to search the table to find a different set of data such as:
# Height BETWEEN 1.6 AND 1.7
# The search would bring up the following result:

NOTE!
Between, AND searches only work with 2 sets of numbers





Explanation! 
This search is looking for data that lies within a range. The people in the orange cells would be returned as a result because: 

Robert Height = 1.65 


NOTE!
All of these heights are between 1.6 and 1.7 metres





Karen Height = 1.6 




Frank Height = 1.7 









Activity! 
Click the above task and follow the instructions given on the sheet. Make sure that you complete all tasks on the sheet. 






