MySQL increases or decreases the specified time interval for the current data table.
The DATE_ADD () function adds a specified interval to a date.
All data in the current table will be added one day later:
UPDATE ACT_BlockNum SET CreateTime = DATE_ADD (CreateTime, INTERVAL 1 DAY );
All data in the current table is reduced by one day:
UPDATE ACT_BlockNum SET CreateTime = DATE_ADD (CreateTime, INTERVAL-1 DAY );
To prevent null exceptions in database queries, when the query result is returned as an integer, it can be compared with 0. If it is null, a zero value is returned to the customer. Otherwise, the query result value is changed, the SQL statement is as follows: SELECT IFNULL (SUM (Num), 0) from DPEvent. ACT_BlockNum where CreateTime BETWEEN # startTime # AND # endTime #; mysql ifnull (expr1, expr2)
If expr1 is not NULL, IFNULL () returns expr1; otherwise, it returns expr2. IFNULL () returns a number or string value, depending on the context in which it is used. Similar
Isnull (expr)
If expr is null, the return value of isnull () is 1; otherwise, the return value is 0.
Update statement to update values of Multiple Fields
update @A set c1=b.c1 ,c2=b.c2,c3=b.c3from @A a,@B b where a.id=2 and b.id=6
Update
Set (A. a2, A. a3) = (select B. b2, B. b3
From B
Where B. b1 = A. a1 and A. a3 = 100
)