mysql中为表增加外键
One of my customers recently asked me to increment the date field on an event in their database by 14 days because their upcoming event got delayed. I knew the SQL statement would be simple and after doing some quick research, I found the magical SQL:
我的一位客户最近要求我将他们数据库中某个事件的日期字段增加14天,因为他们即将发生的事件被延迟了。 我知道SQL语句很简单,并且在进行了一些快速研究之后,发现了神奇SQL:
UPDATE events SET date_starts = DATE_ADD(date_starts,INTERVAL 14 DAY) WHERE event_id = 3;
This works on DATE and DATETIME field types. Note that it's "14 DAY" and not "14 DAYS".
这适用于DATE和DATETIME字段类型。 请注意,它是“ 14 DAY”而不是“ 14 DAY S ”。
mysql中为表增加外键