MySQL database technology (10) [group chart] 2.4 expression evaluation and type conversion
MySQL allows you to write expressions that include constants, function calls, and table column references. These values can be combined using different types of operators, such as arithmetic operators or comparison operators. The expression items can be grouped by parentheses. The expression appears most frequently in the SELECT statement column selection list and WHERE clause, as shown below:
Each selected column provides an expression, as shown in the WHERE clause. The expression also appears in the WHERE clause of the DELETE and u p d ate statements, and in the VALUES () clause of the I N S E RT statement.
When MySQL encounters an expression, it evaluates it to get the result. For example, (4*3)/(4-2) is worth 6. Expression evaluate may involve type conversion. For example, when MySQL is used in 960821 for an environment that requires a date value, convert it to the date "1 9 9 6-0 8-2 1 ". This section describes how to compile MySQL expressions and the type conversion rules used by MySQL in expression evaluation. Every MySQL operator has been introduced, but MySQL has so many functions that we have only touched on. For more information about each operator and function, see Appendix C.