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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.