javascriptsqlhtmloracle-sqldeveloperweb-sql

Get all rows based on given date in web sql


I have a EVENTS Table with multiple Date columns (startDate, endDate). I need to query and get records based on a given date. For example if i run my query with May 11th Saturday as endDate, it should return rows with ID 8 and 12

enter image description here

i tried with following queries but no result

SELECT * 
FROM EVENTS 
WHERE startDate BETWEEN '2019-05-09 00:00:00.00' AND '2019-05-09 23:59:59.999'

Solution

  • If your columns are stored as dates, you should be able to use:

    WHERE startDate >= DATE '2019-05-09' AND
          startDate < DATE '2019-05-10'
    

    However, your dates look like strings. I would recommend first fixing the data model. But, you can also use string operations:

    WHERE startDate LIKE '%May 09 2019%'