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
How can you control the amount of free space in your index pages?
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?
Is it important for a database administrator to understand the operating system and file access?
How to truncate the log in sql server 2012? : sql server database administration
What is a db view?
What is the purpose of sql profiler in sql server? : sql server database administration
How to filter records of table in SQL SERVER?
How to provide login information for a new odbc dsn?
Characterize join and name diverse sorts of joins?
Can we use trigger new in before insert?
What is the datatype of rowid?
Explain various On-Delete options in a DB table. Which is the default option?
Explain what stored procedure sp_replcounters is used for? : sql server replication
What is the simplest way to create a new database in ms sql server?
Is it possible in sql table to have more than one foreign key?