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

Write a stored procedure for emplpoyee and department table to get DeptName which having no employee. Table Structure- Emp-Emp_Id,Emp_Name,Dept_id Dept-Dept_Id,Dept_Name

7 Answers   TCS,


How to delete duplicate rows?

0 Answers  


is it possible to use a variable in a query with the IN clause (a,b,c..z), without getting quotes or conversion errors?

2 Answers  


We create an index to fast the search. How it fast the query? Do we write any special keyword with query?

3 Answers  


When we are using this query to shrink the log file,what exactly it will execute internally? Do we lose any data when we run this script? which data it will truncate in the log file and where it is saved. Please let me know... USE DatabaseName GO DBCC SHRINKFILE(<TransactionLogName>, 1) BACKUP LOG <DatabaseName> WITH TRUNCATE_ONLY DBCC SHRINKFILE(<TransactionLogName>, 1) GO

1 Answers   Cognizant,






What is the primary use of the model database?

0 Answers  


what is the difference between a primary key and a unique key? : Sql server database administration

0 Answers  


What is sql view?

0 Answers  


Tell me time data type, datetime2, datetimeoffset data type in sql server 2008?

0 Answers  


How to connect sql server management studio express to sql server 2005 express?

0 Answers  


What is transaction server explicit transaction?

0 Answers  


Where do you think the users names and passwords will be stored in sql server?

4 Answers   BirlaSoft,


Categories