- 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
MySQL query to insert row with date?
Let us first create a table −
mysql> create table DemoTable( EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY, EmployeeName varchar(100), JoiningDate date ); Query OK, 0 rows affected (0.48 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable(EmployeeName,JoiningDate) values('Chris','2019-01-21'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable(EmployeeName,JoiningDate) values('Robert','2016-12-01'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable(EmployeeName,JoiningDate) values('Mike','2015-03-12'); Query OK, 1 row affected (0.12 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+------------+--------------+-------------+ | EmployeeId | EmployeeName | JoiningDate | +------------+--------------+-------------+ | 1 | Chris | 2019-01-21 | | 2 | Robert | 2016-12-01 | | 3 | Mike | 2015-03-12 | +------------+--------------+-------------+ 3 rows in set (0.00 sec)
- Related Articles
- MySQL query to insert current date plus specific time?
- How to convert US date format to MySQL format in INSERT query?
- How to insert date in single quotes with MySQL date formats?
- How to insert DATE in MySQL table with TRIGGERS?
- Insert row with only default values in MySQL
- Insert with a Select query in MySQL
- How to insert multiple rows with single MySQL query?
- How to insert date record to the same table with different date formats with MySQL?
- How to find specific row with a MySQL query?
- MySQL query to delete row
- MySQL query to fetch date with year and month?
- MySQL query to select records with a particular date?
- MySQL - Insert current date/time?
- MySQL query to insert data from another table merged with constants?
- MySQL query to fetch the latest date from a table with date records

Advertisements