Let us say you get a chance to write DATE in the WHERE clause. Since your query needs DATE comparison, I am going to share with you how to give DATE in the WHERE clause.
I have given three selected examples. You can refer and use the same logic for comparing the DATEs.
SQL Query Compares Dates using ‘>’ Greater than
SELECT * FROM table WHERE purchdate > '2002-10-01';
The syntax for DATE is
datecolumn > ‘XXXX-XX-XX’
- Always you need to give date in quotes.
- You can use <, >, = in DATE comparisons.
SQL Query Compare Dates using ‘<‘ Less than
WHERE purchdate < '2002-10-10';
SQL Query Using DATE ‘=’ Equal to
WHERE purchdate = '2020-04-19;