Chapter 8: Using Operators to Categorize Information
When we are talking about operators in your database, we are talking about the reserved characters and words that are mostly used in the WHERE clause of your statements.
Operators are used in order to perform operations in your statements, such as mathematical equations and comparisons, and they can even help to specify the parameters you want to set for the statements.
And of course, they are able to connect more than one parameter that is found within the SQL statement.
There are a few different types of operators that you will be able to use within your SQL statement including:
Each of these will work in a slightly different way to help you to get the results that you want. 
Logical operators
The logical operators are going to be the keywords that you will use in your statements in order to perform comparisons.
Some of the logical operators you can use include:
You will get a true if one or more of the specified values is equal to the value that you test.
You will usually combine it with the “_” or the “%” sign to get more done.
The underscore is used to represent a number or a character ad the % is used for several characters, zero, or one.
It basically allows you to put down some criteria and see if there are any rows that exist that meet with this. 
You will need to assign the maximum and the minimum values to make this work. 
Any operator is going to compare a value against all of the values on a list.
The list of values is to be set up with predetermined conditions.
ALL, on the other hand, will compare the values that you select against the values that are in a different value set.
These are important for helping you to look up new data points within your database or to make some comparisons.
You can try out a few of these in your database and see what they come up with.
Comparison operators
The comparison operators are great if you would like to check the single values that are found inside of an SQL statement.
This particular category is going to be composed of some basic mathematical signs, so they are pretty easy to figure out.
Some of the comparison operators that you will be able to use within your SQL database includes:
The operation is going to give you the result of TRUE if the data does not equal and FALSE if the data does equal.
You can also use the “!=” to check for this as well. 
You will simply need to use the “=” sign to check for this.
You are only going to get a response if the data that you chose has identical values.
If the values aren’t equal, you will get a false, and if they are equal, you will get a true. 
They will work as stand-alone operators if you would like, but often they are more effective when you combine them together with some of the other operators.
Arithmetic operations
These operators are great if you are looking to do some mathematical operations in your SQL language.
There are four main type types that you will be able to use in your equations.
These include:
For this example, we are going to add up the values for the overhead column and the materials column.
The statement that works for this is:
You will simply need to use the “-“ sign to do this. 
You would need to use the “*” sign to do this. 
You can combine a few of the arithmetic operations as well if this is what your process needs.
For example, you may want to go through and figure out how much you are earning each month and then subtract the costs when you are all done.
Your earnings are probably going to have more than one entry, and this is possible for how much you spent as well, so you may need to do a few different operations to make this happen.
If you are going to use any combination of arithmetic operators, you need to remember that the principles of precedence are going to come into play.
This means that the syntax is going to take care of all the things that need to be multiplied first, and then the division, and then addition, and then subtraction.
It will not go from left to right, but it will go around to work with the symbols that you have up for the arithmetic operations, so keep this in mind when you are writing out your syntax.
Operators to use when negating conditions
In some cases, you will want to negate the operators in your database when you want to change the viewpoint of the condition.
You will want to use the NOT command in order to cancel the operator that it is used for.
Some of the techniques that you can use to do this include:
For example, if you did use the “<>” or the “!=” symbols, you would get anything that was not equal to the value that you placed into the equation. 
For example, if you are using a price, you could decide that you want to find the values that are not between 500 and 1000 or any value.
This means that all the values that come up need to be either 499 and below or 1001 and above. 
You will be able to pick some values that you don’t want to have listed, and then the not in command will return you anything that doesn’t fit in that amount. 
When you are using this, you are only going to see the values that are different from the one that you placed into the equation. 
You will want to use this in order to check for the data that isn’t null.
These are going to help you to set up some of the conditions of your search, so you are able to get a wide variety of information back without having to go through every little part of your database.
Conjunctive operators
There are going to be times when you will need to use several different criteria to make something happen.
For example, if you are getting some results that are confusing from the database searches, you may decide to add in a few different criteria to see how it will turn up.
You will be able to combine together some different criteria in the statement in order to make the conjunctive operator.
Some of the conjunctive operators that you can use include:
Before this statement can take action, the criteria need to be separated by the OR, or it should be TRUE.
The statement will then only take action when the criteria have been segregated by the AND, and they are all true.
Keep in mind there are times when you will want to combine these operators together inside of the statement.
Just make sure that you are adding in parentheses to improve readability.