Explore BrainMass

Using OR, AND, ANY, and ALL with SQL queries

This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

The OR and AND operators are used in compound conditions. Is there any relationship between these operators and the ALL and ANY operators? Outside references are required.

© BrainMass Inc. brainmass.com March 21, 2019, 7:02 pm ad1c9bdddf

Solution Preview

The MySql operators OR and AND can be used in conditions in a query. For example:

SELECT * FROM mytable WHERE id > 100 AND age < 65;

This statement selects all the items from the table where the id is
greater than 100 AND the age is less than 65. Both conditions must be
met. Likewise, the following query uses the OR operator:

SELECT * FROM mytable ...

Solution Summary

This solution shows how to use OR, AND, ANY, and ALL in SQL queries. It also explains how they work.