Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Sql Sqldate Mysql date field

Related Tutorials


 
 

Share on Google+Share on Google+

Mysql date field

Advertisement
Mysql date field help you to create the data field and their respective data type.

Mysql date field

     

Mysql date field help you to create the data field and their respective data type.

Understanding with Example

The Tutorial illustrate an example to create date field in Mysql. The create table statement is used to create a table 'employee2' with field name and date respectively. The data type used for date is date data type.  

Query for creating date field:-

CREATE TABLE employee2( Empid int(10),Empname varchar(60),date date );

Output:-

Query for insertion of data:-

The insert into add the records value into the table 'employee2'.The format of date date type is 'YYYY-MM-DD'.

mysql> insert into employee2 values('02','Girish','2008-12-23');
mysql> insert into employee2 values('01','Komal','2008-12-21');

Query for viewing data of the table:-

To view a table, we use select Query to display the records from a table 'employee2'. 

mysql> select * from employee2;

Output:-

+-------+---------+------------+
| Empid | Empname | date |
+-------+---------+------------+
| 2 | Girish | 2008-12-23 |
| 1 | Komal | 2008-12-21 |
+-------+---------+------------+
2 rows in set (0.00 sec)
Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 3, 2006

Related Tutorials

Discuss: Mysql date field  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com