How to choose time period in mysql?

I want to make a selection of MySql over a period of time. but I did not understand how to do it right.

that's what i tried

SELECT * FROM rapoarte WHERE DATE(ziua) BETWEEN 2010-01-12 AND 2011-01-14

Can you help?

thanks Sebastian

+3
source share
2 answers
SELECT * FROM rapoarte WHERE DATE(ziua) BETWEEN "2010-01-12" AND "2011-01-14"
+1
source

If performance is a problem, I would avoid using it DATEthis way, as this will prevent the index from being used efficiently and lead to a full crawl. For small tables, this may not be a problem, but if your table is large, you will probably find that it gives better performance:

SELECT *
FROM rapoarte
WHERE ziua >= '2010-01-12'
AND ziua < '2010-01-15'
+6
source

Source: https://habr.com/ru/post/1773580/