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 is a scheduled job or what is a scheduled task?

535


What are logical database components? : SQL Server Architecture

479


What is the meaning of sql server?

526


How to search for a string in all stored procedure in sql server?

534


How do I view views in sql server?

516






How to divide query output into multiple groups with the group by clause in ms sql server?

563


What are key, name and value columns of an attribute? : sql server analysis services, ssas

570


What is indexed view? How to create it?

595


Can you explain what are commit and rollback in sql?

485


How to Insert multiple rows with a single insert statement?

543


What is normalization of database? What are its benefits?

515


what is a major difference between sql server 6.5 and 7.0 platform wise? : Sql server database administration

497


How to list all field names in the result set using mssql_field_name()?

524


What do you understand by user-defined function in the sql server and explain the steps to create and execute a user-defined function in the sql server?

520


Do you know the isolation level that sql server support?

522