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


Please Help Members By Posting Answers For Below Questions

How to loop through result set objects using odbc_fetch_row()?

645


When would you use sql joins?

687


What are triggers in ms sql server?

795


Is INSTEAD OF trigger directly applicable to Table ?

735


Relational calculus is what type of language?

780






What to check if a User database is locked?

768


How to disable triggers using "disable trigger"?

779


What is a result set object returned by mssql_query()?

737


What is use of attributehierarchyenabled? : sql server analysis services, ssas

799


you have a table with close to 100 million records recently, a huge amount of this data was updated now, various queries against this table have slowed down considerably what is the quickest option to remedy the situation? : Sql server administration

708


What is the meaning of resultset type_scroll_insensitive?

730


How do you test your database? : sql server database administration

715


What is logshipping and its purpose?

739


What is the difference between a function and a trigger?

767


How to create user defined functions with parameters?

843