AND Operator

In the previous section, we saw the basics of filtering with the WHERE clause where we filtered the output for a specific column. The AND operator extends that capability to filter for multiple columns. It allows us to filter the results of our query against multiple fields contained in the source tables.

Let's see this in an example. Suppose we wanted to see all customers from Canada whose shipment via United Package. United Package shipped is coded with the number 2. We want to know the customer_id, country, ship_via and freight load. The query to return this data is given below:

select customer_id , ship_country , ship_via, freight
from orders
where ship_country = 'Canada' and ship_via = 2

| customer_id | ship_country | ship_via | freight |
| ----------- | ------------ | -------- | ------- |
| 2005        | Canada       | 2        | 22.8    |
| 2018        | Canada       | 2        | 37.25   |

As expected, both conditional filters have been using the AND clause. In the next section, we are going to look at the OR operator which allows for multiple conditional filters on a column.