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 disadvantages of using querystrings to send data from one page to another?
What are the Advantages of using CTE in sql server?
What is join and name different type of joins?
Comment,Datatypes are unlimited
What is database replication?
Is it possible to run multiple publications and different type of publications from the same distribution database? : sql server replication
How to retrieve error messages using odbc_errormsg()?
How can we delete Duplicate row in table?
How to create a trigger for insert only?
How many types of subqueries are there in sql server?
What are the differences in Clustering in SQL Server 2005 and 2008 or 2008 R2?
after migrating the dts packg to ssis by using migrtn wizrd in 2005. iam not able to open ssis pack and getting error. what r those errors? how to resolve?
While migrating Microsoft SQL Server 2008 database to SQL Azure, what can be done to ensure the database connectivity does not degrade?
Explain the advantages of merge replication?
Can you explain how long are locks retained within the repeatable_read and serializable isolation levels, during a read operation with row-level locking?