Sql

Asked • 05/18/19

MySQL "between" clause not inclusive?

If I run a query with a `between` clause, it seems to exclude the ending value. For example: select * from person where dob between '2011-01-01' and '2011-01-31' This gets all results with `dob` from '2011-01-01' till '2011-01-30'; skipping records where `dob` is '2011-01-31'. Can anyone explain why this query behaves this way, and how I could modify it to include records where `dob` is '2011-01-31'? (without adding 1 to the ending date because its been selected by the users.)

1 Expert Answer

By:

Blackstone H. answered • 05/19/19

Tutor
5 (6)

Senior Database Developer using SQL, Visual Basic (VB)

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.