time diff sql query code example Example: date diff sql SELECT DATEDIFF(year, '2017/08/25', '2011/08/25') AS DateDiff;