The BETWEEN ... AND operator is used to specify a selection criteria by requiring an expression to be equal to one of, or fall between the range defined by, two values.
These values can be numbers, characters, strings, or dates, but you cannot use any wildcard characters. The characters, strings, and dates must be enclosed by a pair of single quotes.
SELECT Title FROM ElvisSongs
WHERE ReleaseDate BETWEEN #1/1/56# AND #12/31/57#
Title
Heartbreak Hotel
Blue Suede Shoes
Jailhouse Rock
Teddy Bear
(4 row(s) affected)
In this query, we search for song titles released from 1956 until 1957.
SELECT Title FROM ElvisSongs
WHERE ReleaseDate NOT BETWEEN #1/1/56# AND #12/31/57#
Title
Hard Headed Woman
My Wish Came True
A Big Hunk of Love
Stuck on You
Crying in the Chapel
Suspicious Minds
(6 row(s) affected)
This query uses the NOT operator to search for values that lie outside the range specified.