SQL MAX/MIN(datetime) Help

Hello all,

I am working on my own independent project with SQLite. I am using the following code to find the max and min date from the table.


SELECT MAX(date_column), MIN(date_column)
FROM table1;

The question I have is, the result does not come back accurately. For example, the true min date is June 2014. But the MIN date result come as January 2015.

What could be the problem here? The date column type was set up as “TEXT”. And it’s in the following format, “YYYY-MM-DD, HH:MM:SS”.

Thank you all!


It’s hard to say without looking at the db or csv file it’s drawing from. Is this from one of the Codecademy exercises?

Did you try select * from table1 and to check that the true min is june 2014?

Hi. Thank you for your response. I have tried using a SELECT * and the date comes up as June 2014. But when I do MIN(Occured_date_time), it comes up as January 2015. And this is an independent project that I am working on. It’s not from Codecademy.