This example illustrates how to get date and time between specific time interval.
This example illustrates how to get date and time between specific time interval.This example illustrates how to get date and time between specific time interval.
In this example we create a query "select lastAccess from emp WHERE lastAccess BETWEEN '2008-09-01' AND '2008-12-01'" to find the data between specified interval. The BETWEEN and AND keyword are used for it.
Query |
select lastAccess from emp WHERE lastAccess BETWEEN '2008-09-01' AND '2008-12-01'; |
Output |
+---------------------+ | lastAccess | +---------------------+ | 2008-11-26 11:13:08 | | 2008-10-01 13:17:45 | | 2008-09-01 13:17:45 | | 2008-11-26 11:13:08 | | 2008-11-26 11:13:08 | | 2008-11-26 11:13:08 | | 2008-11-26 11:13:08 | | 2008-11-26 11:13:08 | | 2008-11-26 11:13:08 | | 2008-11-26 11:13:08 | +---------------------+ |