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 is a scheduled job or what is a scheduled task?
What are logical database components? : SQL Server Architecture
What is the meaning of sql server?
How to search for a string in all stored procedure in sql server?
How do I view views in sql server?
How to divide query output into multiple groups with the group by clause in ms sql server?
What are key, name and value columns of an attribute? : sql server analysis services, ssas
What is indexed view? How to create it?
Can you explain what are commit and rollback in sql?
How to Insert multiple rows with a single insert statement?
What is normalization of database? What are its benefits?
what is a major difference between sql server 6.5 and 7.0 platform wise? : Sql server database administration
How to list all field names in the result set using mssql_field_name()?
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?
Do you know the isolation level that sql server support?