Date vs Strings in MySQL

Viewed 50

I've been trying to research the pros and cons to storing a date(ex: 2018-05-09) as a String(varchar) vs a Date datatype in mySQL workbench for an assignment(where I'll be comparing dates from different tables). In my class, the professor strongly advises AGAINST using Dates, as he says they are rarely interoperable. However, this leads me to question, if they seem to be interoperable, why would you use them over a varchar in the first place, if its seemingly niche use doesn't even seem to have any pros over a string? Personally I've found success in using the Date datatype, but I don't want to hold on to a bad habit if it really is inefficient.

I've even seen things where you can easily change the formatting with our format command, whereas I don't know how you would compare dates (which comes before or after) with strings in a query.

Any insight is helpful - again, I'm not looking for an answer to the query, but I can't seem to find any useful articles that compare the pros/cons of storing a Date as a string

0 Answers
Related