Add a time field shaped like MM: SS (MySQL)

I want to add a new temporary field to an existing MySQL table, which is formed like this: "MM: SS". The field must contain duration data. What is the correct MySQL syntax for this? Couldn't find anything that covers this on the MySQL site.

0


source to share


3 answers


Why not just use INTEGER and use it to store the number of seconds? If you want to use it, ask your application (or perhaps even an SQL query) to convert seconds to minutes and seconds.



0


source


Two options:



  • Since it is duration, there are two fields DATETIME

    ; start_time and end_time and then just calculate the difference

  • There is one field DATETIME

    ; start_time and one field INTEGER

    ; length.

0


source


MySQL has a TIME datatype that is specifically designed to store the duration of time.

0


source







All Articles