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



Home Sql Sqldate SQL Date Between

Related Tutorials


 
 

Share on Google+Share on Google+

SQL Date Between

Advertisement
Mysql Date Between return the date between the two existing date.

SQL Date Between

     

Mysql Date Between return the date between the two existing date.

Understand with Example

The Tutorial illustrate an example from 'Date Between in SQL'. To understand this example we create a table 'Employee1'.

Step1:-create table name EMPLOYEE1 in the database:-

Query:-

 

 

 

CREATE TABLE EMPLOYEE1 (
ID int(2) NOT NULL auto_increment,
EMPNAME varchar(30),
ATTENDENCE varchar(10), 
DAT date NOT NULL default '0000-00-00',
PRIMARY KEY (ID)
) ;

Output:-

Step2:-Insert the values in the table by giving the query given below:-

Query:-

INSERT into EMPLOYEE1 VALUES ('01','Girish','P','2008-12-01'),
('02','Komal','A','2008-12-02'),
('03','Mahendra','P','2008-12-03'),
('04','Sandeep','A','2008-12-04'),
('05','Amit','P','2008-12-05');

Output:-

Step3:-Write the query given to view the details for extracting data between the two given dates:-

Query:-

SELECT * FROM EMPLOYEE1 
WHERE DAT BETWEEN '2008-12-01' AND '2008-12-03';

Output:-

 

Advertisements

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: December 31, 2008

Related Tutorials

Discuss: SQL Date Between   View All Comments

Post your Comment


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