- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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.
Advertisements