Let us first create a table −
mysql> create table DemoTable1871 ( ArrivalDate datetime ); Query OK, 0 rows affected (0.00 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1871 values('2019-12-19 7:45:00'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1871 values('2018-11-10 12:00:00'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1871 values('2019-01-31'); Query OK, 1 row affected (0.00 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable1871;
This will produce the following output −
+---------------------+ | ArrivalDate | +---------------------+ | 2019-12-19 07:45:00 | | 2018-11-10 12:00:00 | | 2019-01-31 00:00:00 | +---------------------+ 3 rows in set (0.00 sec)
Here is the query to add days −
mysql> update DemoTable1871 set ArrivalDate=date_add(ArrivalDate, interval 6 day); Query OK, 3 rows affected (0.00 sec) Rows matched: 3 Changed: 3 Warnings: 0
Let us check table records once again −
mysql> select * from DemoTable1871;
This will produce the following output −
+---------------------+ | ArrivalDate | +---------------------+ | 2019-12-25 07:45:00 | | 2018-11-16 12:00:00 | | 2019-02-06 00:00:00 | +---------------------+ 3 rows in set (0.00 sec)