- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Add 30 days to date in a MySQL table with arrival date records
Use INTERVAL to update the days for all the dates in a MySQL table column. Let us first create a table −
mysql> create table DemoTable814(ArrivalDate date); Query OK, 0 rows affected (0.58 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable814 values('2018-12-02'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable814 values('2017-03-12'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable814 values('2019-12-23'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable814 values('2016-06-01'); Query OK, 1 row affected (0.32 sec) mysql> insert into DemoTable814 values('2019-08-03'); Query OK, 1 row affected (0.20 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable814;
This will produce the following output −
+-------------+ | ArrivalDate | +-------------+ | 2018-12-02 | | 2017-03-12 | | 2019-12-23 | | 2016-06-01 | | 2019-08-03 | +-------------+ 5 rows in set (0.00 sec)
Following is the query to add 30 days to date −
mysql> select ArrivalDate+ Interval 30 Day from DemoTable814;
This will produce the following output −
+------------------------------+ | ArrivalDate+ Interval 30 Day | +------------------------------+ | 2019-01-01 | | 2017-04-11 | | 2020-01-22 | | 2016-07-01 | | 2019-09-02 | +------------------------------+ 5 rows in set (0.05 sec)
- Related Articles
- MySQL add days to a date?
- How to change the date in a table with date records with MySQL?
- MySQL query to fetch the latest date from a table with date records
- MySQL query to delete a DATE older than 30 days from another date?
- Add 11 days to current date in MySQL
- Add a single year to all the date records in a MySQL table column
- MySQL query to fetch date records greater than the current date after adding days with INTERVAL?
- Add 30 days to a value in a MySQL table?
- Fetch records from interval of past 3 days from current date in MySQL and add the corresponding records
- Filter dates from a table with DATE and NULL records in MySQL
- How to find last date from records with date values in MySQL?
- MySQL query to count days in date range with start and end date
- How to add a year and two days to a date with a single MySQL query?
- Find the difference between current date and the date records from a MySQL table
- How to add days to $Date in PHP?

Advertisements