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 can you control the amount of free space in your index pages?

609


You are designing a strategy for synchronizing an SQL Azure database and multiple remote Microsoft SQL Server 2008 databases. The SQL Azure database contains many tables that have circular foreign key relationships?

99


Is it important for a database administrator to understand the operating system and file access?

506


How to truncate the log in sql server 2012? : sql server database administration

567


What is a db view?

515






What is the purpose of sql profiler in sql server? : sql server database administration

623


How to filter records of table in SQL SERVER?

597


How to provide login information for a new odbc dsn?

536


Characterize join and name diverse sorts of joins?

526


Can we use trigger new in before insert?

514


What is the datatype of rowid?

506


Explain various On-Delete options in a DB table. Which is the default option?

893


Explain what stored procedure sp_replcounters is used for? : sql server replication

999


What is the simplest way to create a new database in ms sql server?

533


Is it possible in sql table to have more than one foreign key?

608