Database Reference
In-Depth Information
Output
+----------------+------------+
| prod_name | prod_price |
+----------------+------------+
| Detonator | 13.00 |
| Bird seed | 10.00 |
| Carrots | 2.50 |
| Fuses | 3.42 |
| Oil can | 8.99 |
| Safe | 50.00 |
| Sling | 4.49 |
| TNT (1 stick) | 2.50 |
| TNT (5 sticks) | 10.00 |
+----------------+------------+
New Term
OR A keyword used in a WHERE clause to specify that any rows matching either of the
specified conditions should be retrieved.
Understanding Order of Evaluation
WHERE clauses can contain any number of AND and OR operators. Combining
the two enables you to perform sophisticated and complex filtering.
But combining AND and OR operators presents an interesting problem. To dem-
onstrate this, look at an example. You need a list of all products costing 10 or
more made by vendors 1002 and 1003 . The following SELECT statement uses
a combination of AND and OR operators to build a WHERE clause:
Input
SELECT prod_name, prod_price
FROM products
WHERE vend_id = 1002 OR vend_id = 1003 AND prod_price >= 10;
Output
+----------------+------------+
| prod_name | prod_price |
+----------------+------------+
| Detonator | 13.00 |
| Bird seed | 10.00 |
| Fuses | 3.42 |
| Oil can | 8.99 |
| Safe | 50.00 |
| TNT (5 sticks) | 10.00 |
+----------------+------------+
 
 
Search WWH ::




Custom Search