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 / saiteja
In the case of where clause it displays single row,or operator can be placed in where clause in oreder to extend rows.
In IN operator at a time we can place empid multiple times but they must be unique.
ex:
(
select * from emp
where empid=123
);
By using OR operator:
(
select * from emp
where empid=123 or empid=234
);
By using IN operator:
(
select * from emp
where empid IN(123)
);
accordidg to the question the output will be same in both thae cases..
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
what is difference between view and Dip.
This question asked during interview, 2) At the end of each month, a new table is created for each bank that contains monthly metrics consolidated at the account level. The table naming convention is bankX_YYYYMM where X represents the numeric designation of the bank and YYYYMM indicates the 4 digit year and 2 digit month. The tables contain the following fields: name data type description account text account number registered boolean indicates whether the account is registered num_trans integer number of transactions made during the time period spend numeric(9,2) total spend during the time period a) Write a SQL query that will display the total number of transactions and total spend for "Bank1" during the 4th quarter of 2009. b) Write a SQL query that will display the total number of transactions and total spend at "Bank1" and "Bank2", broken out by registered vs. non-registered accounts, during January 2010 not sure what is correct answer and how to solve?
How to execute multiple stored procedures at one time in sql server?
What is the language structure to add a record to a table?
What do you understand by mirroring and mention the advantages of the mirroring?
Which feature in sql server 2008 has surprised you? You can name just one. : sql server database administration
Name the different type of indexes in sql?
Explain the creation and execution of a user-defined function in the sql server?
How to retrieve error messages using mssql_get_last_message()?
What are different types of schemas?
tell me what are the steps you will take to improve performance of a poor performing query? : Sql server database administration
What is a Join and explain its types?
How to remove duplicate rows from table except one?
What do you mean by an execution plan? Why is it used? How would you view it?
What is best institute to Learn DotNET And SQL in chennai?