Question: I am trying to select data from a date range using `BETWEEN` in the where clause,But it does not return the correct result.The date field is in the format `'mm/dd/YYYY'` and the type is `varchar`
My query,

```
select * from time_track where track_date between '01/01/2015' and '01/21/2015'

```

But the result contain data with year 2014.

Can anyone please help me

Answer: 
You need to convert the date string to a real date

```
select * from time_track 
where STR_TO_DATE(track_date ,'%d/%m/%Y') between '2015-01-01' and '2015-01-21'

```

### Or even better use the date data type for that column.

Then you don't need to convert the data in your queries and can make use of indexes which makes it run super fast.
For mysql between clause to work expectedly, ideal values would be integer, date, time or datetime. Try changing the datatype from varchar to datetime. That would do your comparison job.