Chapter 4 QUERYING AND MODIFYING DATA 207 The
Monday, May 11th, 2009Chapter 4 QUERYING AND MODIFYING DATA 207 The plus (+) and minus ( ) can also be used to perform arithmetic operations on date values. Arithmetic operators help perform mathematical operations and have other similar uses in performing statistical operations. Logical operators act against values in a manner that provides for the implementation of multiple conditions. Logical Operators Logical operators, also known as Boolean operators, can also be used within the queries you execute. The three logical operators are AND, OR, and NOT. Their meanings are pretty straightforward: AND adds an additional filter condition to the one specified and returns TRUE only when both or all conditions specified are met. The OR logical operator adds another filter condition to the existing condition as well, but returns TRUE when either condition is met. NOT tells SQL to get everything in the query except for what it has specified. Here is an example of using AND, NOT, and OR: SELECT title_id,type, advance FROM titles WHERE (type= business or type= psychology ) AND NOT advance>5500 This query selects only records that are business-type or records that are psychology-type, both having an advance value not greater then 5500. Note the parentheses around the type condition. They indicate that you want the AND NOT condition to apply to both types. If you wrote: WHERE type = business or type= psychology AND NOT .advance>5500 You would get only psychology blogs where the advance is greater than 5,500. A contrasting use of the logical operators is shown in Figure 4.2. Brackets can significantly alter the results of operations that use logical operators. Test all conditions and alter the precedence by using brackets. According to the order of operations, bracketed comparisons are performed first. The logical operators are evaluated in the order: () first, then NOT, AND, and finally OR.
For high quality jboss hosting services please check jboss web hosting website.