- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- 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
Display records after a particular date in MySQL
Let us first create a table −
mysql> create table DemoTable708 ( CustomerName varchar(100), ShippingDate date ); Query OK, 0 rows affected (0.51 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable708 values('John','2019-01-21'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable708 values('Chris','2019-03-24'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable708 values('Robert','2019-04-26'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable708 values('David','2019-07-22'); Query OK, 1 row affected (0.17 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable708;
This will produce the following output -
+--------------+--------------+ | CustomerName | ShippingDate | +--------------+--------------+ | John | 2019-01-21 | | Chris | 2019-03-24 | | Robert | 2019-04-26 | | David | 2019-07-22 | +--------------+--------------+ 4 rows in set (0.00 sec)
Following is the query to display records after a particular date in MySQL −
mysql> select *from DemoTable708 where ShippingDate >='2019-04-01';
This will produce the following output -
+--------------+--------------+ | CustomerName | ShippingDate | +--------------+--------------+ | Robert | 2019-04-26 | | David | 2019-07-22 | +--------------+--------------+ 2 rows in set (0.00 sec)
Advertisements