Databases| SQL| MySQL| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Mysql Date Search 
 

In this Tutorial you will learn how to' search Date in Mysql'. To understand this example, we create a table 'employee' with required fieldname and datatype respectively.

 

Mysql Date Search

                         

In this Tutorial you will learn how to' search Date in Mysql'. To understand this example, we create a table 'employee' with required fieldname and datatype respectively. The Table employee has a 'empid' as Primary Key. The keyword create table employee is used to create a table 'employee'.

Create table "employee":

CREATE TABLE `employee` ( 
`id` bigint(20) NOT NULL auto_increment, 
`emp_name` varchar(100) NOT NULL, 
`emp_dob` date default NULL, 
PRIMARY KEY (`id`) 

Query to insert the record in the table "employee":

Now the Query insert into is used to add the records or  rows into table 'employee' 

insert into employee (emp_name,emp_dob)values('Sourabh','1985-11-07');
insert into employee (emp_name,emp_dob)values('Vineet','1983-11-07');
insert into employee (emp_name,emp_dob)values('Girish','1984-10-06');
insert into employee (emp_name,emp_dob)values('Sourabh','1982-01-05');

Query to retrieve the records from table "employee":

To view the details of the records from table 'employee' we run select query to retrieve it.

select * from employee;

Output:

mysql> select * from employee
+----+----------+------------
| id | emp_name | emp_dob
+----+----------+------------
| 1 | Sourabh | 1985-11-07
| 2 | Vineet | 1983-11-07
| 3 | Girish | 1984-10-06
| 4 | Sourabh | 1982-01-05
+----+----------+------------
4 rows in set (0.00 sec)

Query to Search record by Date:

The Query below returns the records details from table employee whose emp_dob is '1985-11-07'.

select * from employee where emp_dob='1985-11-07'

Output :

+----+----------+------------+
| id | emp_name | emp_dob |
+----+----------+------------+
| 1 | Sourabh | 1985-11-07 |
+----+----------+------------+

                         

» View all related tutorials
Related Tags: sql mysql c orm form time make format display value this create for ie example values exam e it mms

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.