Combining Conditions with the AND, OR, and NOT Operators
On many occasions, we may need to combine multiple conditions at the same time. The best way to do this in SQL is by using the following three operators, which can be used between conditions in the WHERE
clause:
AND
: This operator makes sure both sides of the operator (both conditions) are true.OR
: This operator makes sure one side at least of the operator is true.NOT
: This operator makes sure that the condition following this operator is false.
Exercise 5.07: Querying Multiple Conditions
Joe, a customer from LA, has requested to speak to the store manager regarding a complaint. We are going to write a query to retrieve all of this customer's details. This will allow the manager to have all the required information to best help resolve the customer's complaint.
The state code for LA is (310). To pull the required information, perform the following steps:
- Enter the query as follows...