Comparison operators between dates will work in a logical manner. In the following example, when comparing two dates, MySQL simply compares two numbers or strings -
mysql> select 20171027 < 20150825; +---------------------------+ | 20171027 < 20150825 | +---------------------------+ | 0 | +---------------------------+ 1 row in set (0.00 sec)
The output 0 indicates that the result of the above query is FALSE.
mysql> select 20171027 > 20150825; +--------------------------+ | 20171027 > 20150825 | +--------------------------+ | 1 | +--------------------------+ 1 row in set (0.00 sec)
Output "1" indicates that the result of the above query is TRUE.
The above is the detailed content of How do comparison operators in MySQL work with date values?. For more information, please follow other related articles on the PHP Chinese website!