Conjunctive Operators

What if you want to used multiple conditions to narrow data in an SQL statement? You must be able to combine the conditions, and you do this with what is call conjunctive operators. These operators are

  • AND

  • OR

These operators provide a means to make multiple comparisons with different operators in the same SQL statement. The following sections describe each operator's behavior.

AND

The AND operator allows the existence of multiple conditions in an SQL statement's WHERE clause. For an action to be taken by the SQL statement, whether it be a transaction or query, all conditions separated by the AND must be TRUE.

ExampleMeaning
WHERE EMPLOYEE_ID = '333333333' AND SALARY = '20000'The EMPLOYEE_ID must match 333333333 and the ...

Get Sams Teach Yourself SQL in 24 Hours, Second 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.