date manipulation in postgresql

Asked

Viewed 42 times

0

I have a database with several records, since 2001 until 2010. How do I select all tuples with dates after the day 2001-05-02? Data is of the type character varying(254).

  • To prepare a query we need a reference ,for example a data_input field ?

  • wanted something like: select * from historico Where data > 2001-12-31. But it didn’t work that way.

  • take a look at my answer there and it most likely was a syntax error even .

1 answer

2


Query using operator >

Example

SELECT * FROM 
MinhaTabela
WHERE data > '2001-05-02'

If you wish to inform an interval with a certain period. You can use the operator BETWEEN

Example :

SELECT * FROM 
FROM 
MinhaTabela
WHERE 
data BETWEEN dataInicial AND dataFinal
  • 1

    the problem was in the same simple quotes. thanks! :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.