Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a MySQL database and an automation script which modifies the data inside once a day. And these columns may have changed by an user manually. What is the best approach to make the system only update the automated data, not the manually edited ones? I mean yes, flagging the cell which is manually edited is one way to do it, but I want to know if there's another way to accomplish this? Just curiosity.

BTW, the question is about cell values, not rows.

share|improve this question
up vote 1 down vote accepted

I would put two DateTime columns in those tables, one called lastUserEdit and the other one called lastAutomatedEdit. That way, you always know whether the last edit on each row was done by a user or automatically by simply comparing these two dates.

share|improve this answer
but it's not any different from flagging. just using date1>date2 as the boolean value. – tpaksu Mar 26 '12 at 14:10

Flagging as you have mentioned is what I'd do. Just by updating the value in an ENUM column ('0','1') to let you know who last updated the record.

share|improve this answer
Yes but I'm looking for different approaches. Like when it's a string, I would prepend a "user:" to it, when it's a date I would add 20 years to it if its user edited etc. And BTW the question is about cells. not rows. – tpaksu Mar 26 '12 at 14:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.