Using Multiple Conditions

The requests we’ve worked with up to this point have been simple and have required only a single condition to supply the answer. Now we’ll look at how you can answer complex requests using multiple conditions. Let’s begin by considering the following request.

“Give me the first and last names of customers who live in Seattle and whose last names start with the letter ‘H’.”

Based on the knowledge you’ve gained thus far, you can ascertain that this request requires an equality comparison condition and a pattern match condition to supply an answer. You’ve identified the conditions you need, but how do you combine them into one search condition? The answer lies in the way the SQL Standard defines the syntax for a search ...

Get SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.