IN Vs OR operator which is best to use sql server.
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
If we drop a table, does it also drop related objects like constraints, indexes, columns, defaults, views, and stored procedures?
Which tcp/ip port does sql server run on? How can it be changed?
What are the events recorded in a transaction log?
How display code or Text of Stored Procedure using Sql query in Sql Server ?
create index a on employee(dno) In this,which index was created?
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
How we can compare two database data?
Are all views updatable ?
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)
What is an execution plan? When would you use it?
what is bit datatype? : Sql server database administration
What does it mean if @@cursor_row returns a negative number?