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



Home Quartz SQL Between Timestamp

Related Tutorials


 
 

Share on Google+Share on Google+

SQL Between Timestamp

Advertisement
This page discusses - SQL Between Timestamp

SQL Between Timestamp

     

A timestamp is used to catch the dates and times. 

Understand with Example

The Tutorial illustrate an example to create a SQL Between Timestamp. The table 'Stu_Table' is created with the help of create statement. 

Create Table

 

 

 

 

CREATE TABLE Stu_Table (
	     Stu_Id varchar(2),
	     Stu_Name varchar(10),
             Stu_Dob timestamp NOT NULL );

Insert Date Into Stu_Table

Now insert into statement is used to add the records or rows into a table 'Stu_Table'.

Insert Into Stu_Table Values('1', 'Komal', '1984-10-27');
Insert Into Stu_Table Values('2', 'ajay', '1985-04-19');
Insert Into Stu_Table Values('3', 'Santosh', '1986-11-16');

Stu_Table

+--------+----------+---------------------+
| Stu_Id | Stu_Name | Stu_Dob             |
+--------+----------+---------------------+
| 1      | Komal    | 1984-10-27 00:00:00 |
| 2      | ajay     | 1985-04-19 00:00:00 |
| 3      | Santosh  | 1986-11-16 00:00:00 |
+--------+----------+---------------------+

Query

The given below query return you the list of records enlisted in the select statement. The Where clause restrict the select query and return you the records from stu_Dob column between '1984-01-01' And '1986-1-1'. 

Select * From Stu_Table
Where Stu_Dob Between '1984-01-01' And '1986-1-1';

Result

+--------+----------+---------------------+
| Stu_Id | Stu_Name | Stu_Dob             |
+--------+----------+---------------------+
| 1      | Komal    | 1984-10-27 00:00:00 |
| 2      | ajay     | 1985-04-19 00:00:00 |
+--------+----------+---------------------+
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: April 18, 2011

Related Tutorials

Discuss: SQL Between Timestamp  

Post your Comment


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