What is the difference between timestamp and datetime in mysql?



What is the difference between timestamp and datetime in mysql?..

Answer / Ruchi Deva

Both TIMESTAMP and DATETIME are used to store date and time values, but there are some differences:

1. Precision: A TIMESTAMP column can store time up to microseconds (precision up to 6), while a DATETIME column can store time up to fractional seconds (precision up to 3).
2. Default Value: If no value is specified, the default value for a TIMESTAMP column is the current date and time, while for a DATETIME column it's '0000-00-00 00:00:00'.
3. Storage Requirement: A TIMESTAMP column takes less storage space than a DATETIME column.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More MySQL Interview Questions

What is the maximum connection pool size?

1 Answers  


What is difference between oracle sql and mysql?

1 Answers  


Can mysql scale horizontally?

1 Answers  


What are mysql queries?

1 Answers  


How to create a trigger in mysql?

1 Answers  


How do I install the latest mysql on ubuntu?

1 Answers  


What's new in mysql 8?

1 Answers  


What is the phantom problem?

1 Answers  


What are the types of queries?

1 Answers  


about join

2 Answers  


How do I edit a table in mysql workbench?

1 Answers  


date funciton

2 Answers  


Categories