MySQL BETWEEN Operator Queries – Are they inclusive?

I recently learned of some odd behavior using MySQL BETWEEN operator queries, filtering by a DATETIME column. I wrote about this over on Medium so I am sharing the post for any readers here who are interested…

Image by _Alicja_ from Pixabay 
Self-Promotion:

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!


I’ve finally started a weekly email, covering SQL/PHP related content. If you’re interested in subscribing, use this sign-up form or the one located at the bottom of the page. Thank you!


In my eclectic day job, I cover many tasks. Most of them I do not care for. However, I work extremely hard at those so I can work on the one task I do like; programming a custom internal LAMP stack web application.

I have been working on this web application for over a year and it has grown immensely. Anyways, enough yada yada. On to the crux of the matter.


Consider making a donation as I continue to provide valuable content here on my blog. Thank you so much!!! Every bit is much appreciated and helps tremendously!


While prototyping out a query which retrieves PDF’s stored in the database (check out this post on the intricacies), I learned some interesting aspects of the BETWEEN operator involving DATETIME column values.

I’ll leave it there for now and let you dig into the actual article, Are MySQL BETWEEN Operator Queries Inclusive.

Feel free to share your thoughts or any comments you may have about these types of queries in the comments section below.

Like what you have read? See anything incorrect? Please comment below and thank you for reading!!!

A Call To Action!

Thank you for taking the time to read this post. I truly hope you discovered something interesting and enlightening. Please share your findings here, with someone else you know who would get the same value out of it as well.

Visit the Portfolio-Projects page to see blog post/technical writing I have completed for clients.



To receive email notifications (Never Spam) from this blog (“Digital Owl’s Prose”) for the latest blog posts as they are published, please subscribe (of your own volition) by clicking the β€˜Click To Subscribe!’ button in the sidebar on the homepage! (Feel free at any time to review the Digital Owl’s Prose Privacy Policy Page for any questions you may have about: email updates, opt-in, opt-out, contact forms, etc…)

Be sure and visit the “Best Of” page for a collection of my best blog posts.


Josh Otwell has a passion to study and grow as a SQL Developer and blogger. Other favorite activities find him with his nose buried in a good book, article, or the Linux command line. Among those, he shares a love of tabletop RPG games, reading fantasy novels, and spending time with his wife and two daughters.

Disclaimer: The examples presented in this post are hypothetical ideas of how to achieve similar types of results. They are not the utmost best solution(s). The majority, if not all, of the examples provided, are performed on a personal development/learning workstation-environment and should not be considered production quality or ready. Your particular goals and needs may vary. Use those practices that best benefit your needs and goals. Opinions are my own.

Hey thanks for commenting! Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.