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 difference between “where” and “having” clause in sql server?
Can we return Data from 4(more than 1) tables in stored procedure?
What is GUID in sql server?
How do you delete a data source?
Give an example of why you would want to denormalize a database
How to find the second highest salary of an employee?
Other than truncate statement, which other command can by-pass the trigger on the tables?
Explain transaction server consistency?
How can we rewrite sub-queries into simple select statements or with joins?
What do we need queues in sql service broker?
How to rebuild master databse?
How to define output parameters in stored procedures?
What is the difference between stored procedure and user defined functions?
What is shared lock?
What is a join in sql? What are the types of joins?