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


Please Help Members By Posting Answers For Below Questions

What are the 3 types of schema?

780


Does a full backup include transaction log?

683


How to override dml statements with triggers?

747


What objects does the fn_my_permissions function reports on? : sql server security

749


What is SubQuery in SQL Server 2008

714






What is the difference between indexing and hashing?

752


What is the purpose of forms?

686


Can we store videos inside the sql server table?

711


How do use Having,Group by,Group function in SQL?

1535


what is bit datatype and what's the information that can be stored inside a bit column? : Sql server database administration

718


Tell me in brief how sql server enhances scalability of the database system?

713


What is the difference between varchar and varchar types?

744


what are the different types of replication you can set up in sql server? : Sql server database administration

745


If you want to send some data from access database to sql server database. What are different component of ssis will you use?

683


Explain syntax for viewing trigger?

708