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

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