Description: The OR condition allows you to create an SQL statement where records are returned when any one of the conditions are met. It can be used in any valid SQL statement - select, insert, update, or delete.
Language: Highlight Mode: PLSQL Last Modified: March 07th, 2009
The syntax FOR the OR condition IS:SELECT columns
WHERE column1 ='value1'OR column2 ='value2';
The OR condition requires that ANYOF the conditions be must be met FOR the RECORDTO be included IN the result SET.IN this CASE, column1 has TO equal 'value1'OR column2 has TO equal 'value2'.
The FIRST example that we'll take a look at involves a very simple example using the OR condition.
WHERE city = 'NEW York'
or city = 'Newark';
This would return all suppliers that reside in either New York or Newark. Because the * is used in the select, all fields from the suppliers table would appear in the result set.
The next example takes a look at three conditions. If any of these conditions is met, the record will be included in the result set.
WHERE name = 'IBM'
or name = 'Hewlett Packard'
or name = 'Gateway';
This SQL statement would return all supplier_id values where the supplier's name IS either IBM, Hewlett Packard OR Gateway.
SQL University.net courses meet the most demanding needs of the business world for advanced education
in a cost-effective manner. SQL University.net courses are available immediately for IT professionals
and can be taken without disruption of your workplace schedule or processes.
Compared to traditional travel-based training, SQL University.net saves time and valuable corporate
resources, allowing companies to do more with less. That's our mission, and that's what we deliver.