date - What's the point of MySQL's DATE_SUB() function if negative DATE_ADD() is the same? -


what purpose mysql's date_sub() function if can use date_add() negative interval? there reason choosing 1 option on other?

-- equivalent: select date_sub(now(), interval 24 hour); select date_add(now(), interval -24 hour); 

you're correct date_sub() , date_add() same thing. happens,

select now() - interval 24 hour 

also show in example.

there's no measurable efficiency difference between these forms. it's wise choose 1 makes query easiest understand next person @ it.


Comments