sqloracle-databaseselect-query

how to display the field date (type data = date) whose record is above it 12/29/2018


I have trouble in the SQL query to display the data fields whose records are above 29-12-2018 on Oracle ,

SELECT * FROM 
data 
WHERE date BETWEEN('29-12-2018' AND '01-01-2019')
ORDER BY datetime DESC

Solution

  • You need to use to_date() function to convert your string to a date.

    SELECT * FROM 
    data 
    WHERE "date" > to_date('29-12-2018','DD-MM-YYYY')
    ORDER BY datetime DESC