How can we know the number of days between two given dates
using MySQL?
Answers were Sorted based on User's Feedback
Answer / sergii
DATEDIFF(expr1,expr2)
DATEDIFF() returns expr1 – expr2 expressed as a value in
days from one date to the other. expr1 and expr2 are date
or date-and-time expressions. Only the date parts of the
values are used in the calculation.
mysql> SELECT DATEDIFF('1997-12-31 23:59:59','1997-12-30');
-> 1
mysql> SELECT DATEDIFF('1997-11-30 23:59:59','1997-12-31');
-> -31
| Is This Answer Correct ? | 9 Yes | 1 No |
Answer / shwetha
There is a operator {not} BETWEEN ,we can use this in where
clause to get in between dates.
ex:
select count(column name)
from table1
where dates BETWEEN '01-jul-04' and '01-jul-05';
| Is This Answer Correct ? | 4 Yes | 4 No |
How can you retrieve a portion of any column value by using a select query?
What is mysql default port number?
What is the maximum size of mysql database?
How can we convert between Unix & MySQL timestamps?
How can you export the table as an xml file in mysql?
How do I grant privileges to a user in mysql phpmyadmin?
How do you rename a procedure in mysql?
What is DML in MySQL?
What is the difference between primary key and candidate key?
What is DDL in MySQL?
How do I rename a procedure?
Write a query to select all teams that won either 1, 3, 5 or 7 games.
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)