Search This Blog

Thursday, October 27, 2011

what Is difference Between In Operator And Between Operator


Hi,

In Operator :

Generally IN Operator Is Used to Get The Results Of Multiple Values Which were
with any of the values in a list
Eg :
i Have Table Like

sid Sname
1 Amjad
2 liyaqat
3 shoukath
4 ali

The IN operator allows you to specify multiple values in a WHERE clause.

IN operator Used For Selected Values Record

SELECT Stu_Id, Stu_Name
FROM Stu_Table
WHERE Stu_Name IN('amjad', 'ali')

The Result will Give The Details Of amjad , Ali

-------------
Between Operator :

The BETWEEN operator selects a range of data between two values. The values can be numbers, text, or dates.

Eg :


SELECT Stu_Id, Stu_Name, Stu_Class
FROM Stu_Table
WHERE Stu_Name between 'amjad'and 'ali'

Results It will Give The All The Records From amjad to Ali

Note : Including amjad and ali record as well

-------------------------------------

Difference :

IN operator :

Use the IN operator in a WHERE clause to compare a value with any of the values in a list

Between Operator :

The BETWEEN operator selects a range of data between two values. The values can be numbers, text, or dates.


---------------

Thanks & Regards
Amjad ali







No comments:

Post a Comment