Databases| SQL| MySQL| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
SQL Between Datetime 
 

The Tutorial illustrate an example from SQL Between Date time. The example create a table 'Stu_Table'.

 

SQL Between Datetime

                         

The Tutorial illustrate an example from SQL Between Date time. The example create a table 'Stu_Table'. The create table statement is used to create a table 'Stu_Table'. The data type for the field Stu_Dob is date time. The Date Time structure tell you an instant in time, hold both date and a time. 

Create Table Stu_Table

Create Table Stu_Table (Stu_Id varchar(2), Stu_Name varchar(15), Stu_Dob datetime);

Insert Data Into Stu_Table

The insert into add the records or rows to the table 'Stu_Table'.

insert into stu_table values('1', 'Komal', '1984-10-27 02:10:00');
insert into stu_table values('2', 'Ajay', '1985-04-19 12:10:25');
insert into stu_table values('3', 'santosh', '1986-11-16 23:46:34');

Stu_Table

+-----------+----------+---------------------+
| Stu_Table | Stu_Name | Stu_Dob             |
+-----------+----------+---------------------+
| 1         | Komal    | 1984-10-27 02:10:00 |
| 2         | Ajay     | 1985-04-19 12:10:25 |
| 3         | Santosh  | 1986-11-16 23:46:34 |
+-----------+----------+---------------------+

Query

The given below query return you the records from table 'Stu_Table' .The Where Clause restrict the records on the basis of Stu_Dob as specified in condition.

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

Result

+-----------+----------+---------------------+
| Stu_Table | Stu_Name | Stu_Dob             |
+-----------+----------+---------------------+
| 1         | Komal    | 1984-10-27 02:10:00 |
| 2         | Ajay     | 1985-04-19 12:10:25 |
+-----------+----------+---------------------+

                         

» View all related tutorials
Related Tags: sql mysql c string com function fun io sed const char int ai padding length character case cas if ie

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.