Logic ◾ 87
Note that the terms NY and CA must be enclosed in quotations to dis-
tinguish those elements as merely textual elements. is query produces
a list of four donors: Helen Lobby, Reggie Green, Harvey Levirage, and
Robin Round.
For our nal example, consider an SQL query to locate every donor
that is under 40 years of age, has donated at least $500 in the past, and
lives in either New York or California. e table contains only two such
donors: Helen Lobby and Reggie Green. e SQL query to generate this
list is given as
SELECT First, Last FROM Donor WHERE Age < 40 AND Amount >=
500 AND (State = ‘NY’ OR State = ‘CA’)
e ability to precisely express database queries as logical predicates is
a vital skill for anyone who works with la ...