Databases Reference
In-Depth Information
Since no number can be at the same time greater than or equal to 12 and
less than or equal to 10, no rows will be returned from a query with this
WHERE clause.
IN the Thick of Things
The IN operator makes it easy to specify a list of values to search for in a WHERE
clause. The IN clause contains a list of one or more values, separated by commas
and enclosed in parentheses:
IN ( value1 , value2 , ...)
It is ideal for situations where the values to be selected aren't in a range that
the BETWEEN operator (or a pair of comparisons with an AND) can easily handle.
At Scott's widget company, one of the vice presidents, one of the store man-
agers, and one of the purchasing managers will be temporarily moving to Chi-
cago to open a new branch office. The employees who report to them will also
move. The manager IDs for these positions are 102, 114, and 121. Janice writes
a query to identify the people who are moving along with their managers:
select employee_id "Emp ID", manager_id "Mgr ID",
last_name || ', ' || first_name "Name" from employees
where manager_id in (102, 114, 121);
Emp ID Mgr ID Name
---------- ---------- ----------------------------
103 102 Hunold, Alexander
115 114 Khoo, Alexander
116 114 Baida, Shelli
117 114 Tobias, Sigal
118 114 Himuro, Guy
119 114 Colmenares, Karen
129 121 Bissot, Laura
130 121 Atkinson, Mozhe
131 121 Marlow, James
132 121 Olson, TJ
184 121 Sarchand, Nandita
185 121 Bull, Alexis
186 121 Dellinger, Julia
187 121 Cabrio, Anthony
14 rows selected.
Search WWH ::




Custom Search