Connecting Conditions with Logical Operators
Use the logical operators AND, OR, and NOT when you're dealing with more than one condition in a WHERE clause. The logical operators are also called Boolean operators.
AND
AND joins two or more conditions and returns results only when all of the conditions are true. For example, the following query will find only the rows in which the author's last name is Ringer and the author's first name is Anne. It will not find the row for Albert Ringer.
SQL
select au_id, au_lname, au_fname
from authors
where au_lname = 'Ringer'
and au_fname = 'Anne'
au_id au_lname au_fname
=========== =================================== ========
899-46-2035 Ringer Anne
[1 row]
The next example finds business books with a price ...
Get Practical SQL Handbook, The: Using SQL Variants, Fourth 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.