th arguments to the result data type. For addition (+), subtraction (-) and multiplication (*), the result data type is chosen as follows: * If either of the arguments is an approximate number (float, double), the result is double. * If either of the arguments is a string (char, varchar, text), the result is double. * If either of the arguments is a decimal number, the result is decimal. * If either of the arguments is of a temporal type with a non-zero fractional second precision (time(N), datetime(N), timestamp(N)), the result is decimal. * If either of the arguments is of a temporal type with a zero fractional second precision (time(0), date, datetime(0), timestamp(0)), the result may vary between int, int unsigned, bigint or bigint unsigned, depending on the exact data type combination. * If both arguments are integer numbers (tinyint, smallint, mediumint, bigint), the result may vary between int, int unsigned, bigint or bigint unsigned, depending of the exact data types and their signs. For division (/), the result data type is chosen as follows: * If either of the arguments is an approximate number (float, double), the result is double. * If either of the arguments is a string (char, varchar, text), the result is double. * Otherwise, the result is decimal. Arithmetic Examples ------------------- Note, the above rules mean that when an argument of a temporal data type appears in addition or subtraction, it's treated as a number by default. SELECT TIME'10:20:30' + 1; +--------------------+ | TIME'10:20:30' + 1 | +--------------------+ | 102031 | +--------------------+ In order to do temporal addition or subtraction instead, use the DATE_ADD() or DATE_SUB() functions, or an INTERVAL expression as the second argument: SELECT TIME'10:20:30' + INTERVAL 1 SECOND; +------------------------------------+ | TIME'10:20:30' + INTERVAL 1 SECOND | +------------------------------------+ | 10:20:31 | +------------------------------------+ SELECT "2.2" + 3; +-----------+ | "2.2" + 3 | +-----------+ | 5.2 | +-----------+ SELECT 2.2 + 3; +---------+ | 2.2 + 3 | +---------+ | 5.2 | +---------+ SELECT 2.2 / 3; +---------+ | 2.2 / 3 | +---------+ | 0.73333 | +---------+ SELECT "2.2" / 3; +--------------------+ | "2.2" / 3 | +--------------------+ | 0.7333333333333334 | +--------------------+ URL: https://mariadb.com/kb/en/type-conversion/https://mariadb.com/kb/en/type-conversion/