database - MySQL Datetime & timestamp for row level and table level -


i need have 3 columns in tables reflect these per requirements:

  • create date/time -> date , time row created. value should never change forever.
  • modified date/time -> date , time portions of row last modified. value change if detail in row changed.
  • updated date/time -> date , time entire row last updated. value change if details in row changed.

in addition need maintain same details @ table level->
- date/time table created
- date/time last row inserted
- date/time last edit took place.

so 2 questions:

1) 3 row cases of date/times: 1 needs datetime , 1 timestamp?
2) 3 table level date/times: can store in same table somehow or need separate table store info, , functions can use this?

end goal automate these date/times, because lot of data lookup tables entered/edited end users front end need db date/times on own in without manual insertions these colunms.

also, need perform reporting on these date/times, hence need ensure can manipulated @ code level breaking down date/times days, weeks, months, years, hours & minutes.

i'm afraid, not possible. stupid drawback in docs says:

for 1 timestamp column in table, can assign current timestamp default value , auto-update value. possible have current timestamp default value initializing column, auto-update value, or both. not possible have current timestamp default value 1 column , auto-update value column.

table level timestamp , reporting can done straightforward using max() , group by.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -