Expression Evaluation and Type Conversion

MySQL allows you to write expressions that include constants, function calls, and references to table columns. These values may be combined using different kinds of operators, such as arithmetic or comparison operators, and terms of an expression may be grouped with parentheses.

Expressions occur most commonly in the column selection list and WHERE clause of SELECT statements:

    CONCAT(last_name, ", ", first_name),
    (TO_DAYS(death) - TO_DAYS(birth) / 365)
FROM president
    birth > "1900-1-1" AND DEATH IS NOT NULL

Each column selected represents an expression, as does the content of the WHERE clause. Expressions also occur in the WHERE clause of DELETE and UPDATE statements, the VALUES() clause ...

Get MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.