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 |
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
How to delete duplicate rows?
is it possible to use a variable in a query with the IN clause (a,b,c..z), without getting quotes or conversion errors?
We create an index to fast the search. How it fast the query? Do we write any special keyword with query?
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
What is the primary use of the model database?
what is the difference between a primary key and a unique key? : Sql server database administration
What is sql view?
Tell me time data type, datetime2, datetimeoffset data type in sql server 2008?
How to connect sql server management studio express to sql server 2005 express?
What is transaction server explicit transaction?
Where do you think the users names and passwords will be stored in sql server?