Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

diff datetime mysql code example

Example 1: mysql date diff

SELECT DATEDIFF(expr1,expr2) as difference_in_days;


select DATEDIFF('2020-05-15', '2020-05-10'); //returns 5
select DATEDIFF('2020-05-13', '2020-05-16'); //returns -3
select DATEDIFF('2020-06-30', '2020-05-30'); //returns 30

Example 2: mysql filter based on datediff

SELECT *
FROM myTable
WHERE birthdate >= 'date1' AND death <= 'date2' AND age > 17 AND age < 55;

Tags:

Sql Example

Related

pip install tensorflow==1.2.0 code example mysql rlike code example how to find the possible combinations of given number in python code example understanding join tables code example how to access class defined under class in python code example does not equal sql acc code example jquery loop through siblings code example add text top image bootstrap code example how to copy the content of virtualbox code example pandas remove duplicate rows based on multiple columns code example node.js +javascript + html code example mysql find id not in another table code example

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy