
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How does comparison operator work with date values in MySQL?
Comparison operator between dates will work in a logical way. In the following example, while comparing two dates, MySQL is simply comparing two numbers or string −
mysql> select 20171027 < 20150825; +---------------------------+ | 20171027 < 20150825 | +---------------------------+ | 0 | +---------------------------+ 1 row in set (0.00 sec)
The 0 output shows that the result of the above query is FALSE.
mysql> select 20171027 > 20150825; +--------------------------+ | 20171027 > 20150825 | +--------------------------+ | 1 | +--------------------------+ 1 row in set (0.00 sec)
The output ‘1’ shows that the result of the above query is TRUE.
- Related Articles
- How does MySQL QUOTE() function work with comparison values?
- How will addition, subtraction, multiplication and division operator work with date values stored in MySQL table?
- In MySQL, how does the precedence of ! operator in comparison with NOT operator depends upon HIGH_NOT_PRECEDENCE SQL mode?
- How does tuple comparison work in Python?
- How will addition, subtraction, multiplication, and division operator work with date represented as MySQL string?
- How does the Comma Operator work in C++
- How does * operator work on list in Python?
- How to use comparison operator for numeric string in MySQL?
- How does in operator work on list in Python?
- How does concatenation operator work on list in Python?
- How does repetition operator work on list in Python?
- How does concatenation operator work on tuple in Python?
- How to find last date from records with date values in MySQL?
- How does the * operator work on a tuple in Python?
- How does MySQL CASE work?

Advertisements