sql compare dates between two dates code example
Example 1: compare date in sql
WHERE DATEDIFF(my_date,'2008-11-20') >=0;
WHERE my_date >= '2008-11-20';
WHERE to_date(my_date, 'YYYY-MM-DD') >= '2008-11-20';
WHERE to_date(my_date, 'YYYY-MM-DD') >= to_date('2008-11-20', 'YYYY-MM-DD');
Example 2: difference in dates sql
SELECT (END_DATE - START_DATE) Days-Total FROM MyTable
/*this works for oracle sql*/