
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Display record with today and tomorrow’s date from a column with date record in MySQL
Let us first create a table −
mysql> create table DemoTable ( AdmissionDate date ); Query OK, 0 rows affected (0.87 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values('2019-08-24'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('2019-08-25'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('2019-08-20'); Query OK, 1 row affected (0.24 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+---------------+ | AdmissionDate | +---------------+ | 2019-08-24 | | 2019-08-25 | | 2019-08-20 | +---------------+ 3 rows in set (0.00 sec)
Following is the query to display record with today and tomorrow’s date −
mysql> select *from DemoTable where AdmissionDate IN(curdate(),curdate() + interval 1 day);
This will produce the following output −
+---------------+ | AdmissionDate | +---------------+ | 2019-08-24 | | 2019-08-25 | +---------------+ 2 rows in set (0.00 sec)
- Related Articles
- Find date record after a particular date from a column with VARCHAR type in MySQL
- Fetch date record that equals today in MySQL
- MySQL select * and find record with current date
- Display all records ignoring the current date record in MySQL
- How to insert date record to the same table with different date formats with MySQL?
- Display month names and year from a column with date records with MySQL
- Display distinct dates in MySQL from a column with date records
- Update record on a specific date matching the current date in MySQL
- Display record with most recent time in MySQL
- Change the column name from a MySQL table with Student record?
- MySQL query to display record with maximum count values in a group with other column values?
- How to search a record by date in MySQL table?
- Order date records and fetch the 2nd ordered record in MySQL
- How to compare the first date and the last date from a MySQL column with date records?
- Retrieve MIN and MAX date in a single MySQL query from a column with date values

Advertisements