1
How can I make a SELECT in the database in which the records have a field that the format is DATE Ex:(2017-05-15) and in the WHERE clause I want for just the year. I also wanted to know if it is better to use the dates in the database in varchar format or date format.
Why would it depend on the need if in my view by what you said the Date provides much more advantages? Does the Date format have a disadvantage compared to Varchar? Or is it a question of the programmer’s taste?
– Junior Topanotti
It goes beyond the programmer’s taste, involves semantics, performance and available resources. It works to store a numerical value in a text field, already formatted, but it is not semantic and in mathematical operations it will require conversions. The same fits the date. When it comes to databases, it is important to think about the type of data due indexing and processing time, comparisons, etc.
– BrTkCa