When we discussed the OR operator, we
demonstrated that we can filter for multiple values. The exact query is
given below that will return values with Countries specified in the
OR operator.
select customer_id , ship_country , ship_via, freight
from orders
where (ship_country = 'Canada' or ship_country = 'Germany' OR ship_country = 'France' )
An alternative method to get to the same results would be to use the
IN operator. Below, is the query that will return the same results
as the above but using the IN operator instead.
select customer_id , ship_country , ship_via, freight
from orders
where ship_country IN ('Canada', 'Germany', 'France')
As to be expected, the output is of all records whose
Country
matches the pre-defined list of countries within the INinlinecode> operator.
This concludes our discussion on the
IN operator. In the next section, we will
look at the negation operator NOT.