What is the difference between WHERE AND IN?
OR
1. SELECT * FROM EMPLOYEE WHERE EMPID=123
2. SELECT * FROM EMPLOYEE WHERE EMPID IN (123)
WHAT IS THE DIFFERENCE?
Answer Posted / saiteja
In the case of where clause it displays single row,or operator can be placed in where clause in oreder to extend rows.
In IN operator at a time we can place empid multiple times but they must be unique.
ex:
(
select * from emp
where empid=123
);
By using OR operator:
(
select * from emp
where empid=123 or empid=234
);
By using IN operator:
(
select * from emp
where empid IN(123)
);
accordidg to the question the output will be same in both thae cases..
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What are the 3 types of schema?
Does a full backup include transaction log?
How to override dml statements with triggers?
What objects does the fn_my_permissions function reports on? : sql server security
What is SubQuery in SQL Server 2008
What is the difference between indexing and hashing?
What is the purpose of forms?
Can we store videos inside the sql server table?
How do use Having,Group by,Group function in SQL?
what is bit datatype and what's the information that can be stored inside a bit column? : Sql server database administration
Tell me in brief how sql server enhances scalability of the database system?
What is the difference between varchar and varchar types?
what are the different types of replication you can set up in sql server? : Sql server database administration
If you want to send some data from access database to sql server database. What are different component of ssis will you use?
Explain syntax for viewing trigger?