IN Vs OR operator which is best to use sql server.

Answers were Sorted based on User's Feedback



IN Vs OR operator which is best to use sql server...

Answer / harinireddy

in is peferable bcoz
by using in we can write set of values at time n check it
where as when we use or we need to mention for each n every
value
like ...
select emp_id from employee where emp_id in(1,2,3,4..)
but in case of or...
select emp_id from employee where emp_id=1 or emp_id=2 or
emp_id=3 or emp_id=4...

Is This Answer Correct ?    9 Yes 0 No

IN Vs OR operator which is best to use sql server...

Answer / swaraj

hi i am swaraj.
Ans:-

As per my opinion The IN operator is best B'coz
Due to IN operator at one time multipale requirtment
van satisfied
But Due to OR operator Only one requirtment get satisfied.
So IN operator is Good.

Is This Answer Correct ?    2 Yes 1 No

IN Vs OR operator which is best to use sql server...

Answer / swaraj

hi i am swaraj.
Ans:-

As per my opinion The IN operator is best B'coz
Due to IN operator at one time multipale requirtment
van satisfied
But Due to OR operator Only one requirtment get satisfied.
So IN operator is Good.

Is This Answer Correct ?    1 Yes 1 No

IN Vs OR operator which is best to use sql server...

Answer / sandeep rana

Both are used for different purposes like...

select * from table where data in(1,2,3,4,5,6)


select * from table where data in(1,2,3,4,5,6) or data1
like('%s','%t')

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

If we drop a table, does it also drop related objects like constraints, indexes, columns, defaults, views, and stored procedures?

1 Answers  


Which tcp/ip port does sql server run on? How can it be changed?

0 Answers  


What are the events recorded in a transaction log?

0 Answers  


How display code or Text of Stored Procedure using Sql query in Sql Server ?

0 Answers   Wipro,


create index a on employee(dno) In this,which index was created?

2 Answers  






Hi all, I need query help for below senorio, could you please help me. TableName = City CITYID ContinuationID CITYNAME 1 1 SAN 1 2 DIEGO 2 1 SAN 2 2 FRANCISCO 3 1 CHICAGO 4 1 NEW 4 2 YORK 4 3 CITY Could you please help me to write a generalized SQL that returns results as given below in the Query result CITYID NAME1 NAME2 NAME3 NAME4 NAME5 1 SAN DIEGO 2 SAN FRANCISCO 3 CHICAGO 4 NEW YORK CITY

5 Answers   TCS,


How we can compare two database data?

0 Answers  


Are all views updatable ?

0 Answers   MCN Solutions,


How to delete duplicate records from a table?(for suppose in a table we have 1000 Records in that we have 200 duplicate Records , so ,how to findout that duplicate Records , how to delete those Records and arranged into sequence order? one more thing that there is no primary key at all)

5 Answers   Infosys, McAfee,


What is an execution plan? When would you use it?

0 Answers  


what is bit datatype? : Sql server database administration

0 Answers  


What does it mean if @@cursor_row returns a negative number?

0 Answers  


Categories