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 / shashi kishor prasad
The where Clause allows you to give so many conditions like
in the above case you can use
select * from employee where empid >122
select * from employee where empid <125
select * from employee where empid between 122 and 125
select * from employee where empid is not null(if null allowed)
and many moer..........
where as
The in clause allows you to give a no of values inside the
parenthesis decided by you like
select * from employee where empid in(123,1234,125)
or
select * from employee where empid in(select empid from
employee where empid>200)
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What are the new features in sql server 2016?
What is inner join? Explain with an example?
What are the properties of primary key?
What is the difference between Clustered and Non-Clustered Index?
What do we have to check in database testing?
What are the risks of storing a hibernate-managed object in a cache? How do you overcome the problems?
How can sql server instances be hidden? : sql server security
What are triggers? How do you invoke a trigger on demand?
How can windows applications connect to sql servers via odbc?
how you can list all the tables in a database?
What is self contained scalar sub query?
where can you add custom error messages to sql server? : Sql server administration
What happens when transaction log is full?
What is the use of keyword with encryption. Create a store procedure with encryption?
What is bulkcopy in sql?