MySQL Tutorials - Herong's Tutorial Examples - Version 4.20, by Dr. Herong Yang
What Is Expression
This section provides quick introductions of main expression categories: numeric, character string, bit string, data and time, and time interval.
Value Expressions: Syntax forms to express operations against data values. SQL divides value expressions into several categories: numeric expressions, character string expressions, bit string expressions, date and time expressions, and time interval expressions.
1. Numeric value expressions are operations that involve numeric values. Examples:
1 + 1 2 / 3 100 * (1 + 0.05) * (1 + 0.06)
2. Character string expressions are operations that involve character strings. Examples:
'Hello' || ' world!' -- Concatenation, not supported by MySQL
3. Bit string expressions are operations that involve bit strings. Examples:
~ x'01' -- Negation
4. Date and time expressions are operations that involve data and time values, and time interval values. Examples:
date '1999-01-01' + interval '1' year; -- adding 1 year timestamp '1999-01-01 01:02:03' + interval '1' minute -- adding 1 minute
Since expressions are made up by operations, let's look at some of commonly used operations in sections below.
Last update: 2015.
Table of Contents