What is the difference between `DATEDIFF()` in MySQL vs `age()` in PostgreSQL for date arithmetic?

Advanced SQL Developer Medium

Advanced SQL Developer — Medium

What is the difference between `DATEDIFF()` in MySQL vs `age()` in PostgreSQL for date arithmetic?

Key points

  • DATEDIFF() in MySQL returns whole days as an integer
  • age() in PostgreSQL returns an interval with years, months, and days
  • Different output types for date arithmetic
  • DATEDIFF() and age() solve date differences uniquely

Ready to go further?

Related questions