Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


select * from emp where sal in(select max(sal) from emp)
here there is any limit for in operator how many values
accpect ?

Answers were Sorted based on User's Feedback



select * from emp where sal in(select max(sal) from emp) here there is any limit for in operator ho..

Answer / ashwin

Hi,
if emp table is containing 8 rows and out of which 2 rows
are having highest salary out of 8 rows then 2 rows will be
displayed.

the emp table is given below
sql>select * from emp;

1 1 ram manager 2 1/6/1985 21500.00 2000.00 20
2 2 ankush clerk 2 2/6/1983 30000.00 1000.00 30
3 3 satish sweeper 3 6/12/1987 20000.00 3000.00 30
4 4 clark manager 4 7/15/1967 14000.00 2000.00 40
5 5 richard dba 5 2/9/1995 30000.00 2000.00 50
6 7 monty sweeper 7 1/12/1987 20000.00 3000.00 30
7 8 ganesh sweeper 8 1/12/1988 2000.00 500.00 20
8 9 ganesh manager 9 2/12/1988 20000.00 500.00 30

sql>select * from emp where sal in(select max(sal) from emp;

EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
2 ankush clerk 2 2/6/1983 30000.00 1000.00 30
5 richard dba 5 2/9/1995 30000.00 2000.00 50

Is This Answer Correct ?    3 Yes 0 No

select * from emp where sal in(select max(sal) from emp) here there is any limit for in operator ho..

Answer / venkat

hi

let us suppose we have 5 employees in emp table having sal
2000,3000,2300,4500,3400
subquery- select max(sal) from emp picks only one value i.e
max-4500

there is no limit for IN Operator.see the below example

subquery- select sal from emp where sal/100=0;

if u hav n number of sal's are divisible by 100 the IN
operator must work on all the SAL's divisible by 100.

According to the usage we need to use best query to retrieve
data by keeping min work on server

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

How do I save the results of sql query in a file?

0 Answers  


What is the maximum number of triggers,can apply to a single table?

2 Answers  


Mention what are the benefits of pl/sql packages?

0 Answers  


How to fetch common records from two tables?

1 Answers  


Why do we use cursors?

0 Answers  


What is Overloading of procedures ?

2 Answers  


What is Function based Index and which type of function we can use in Function base index. can we use aggregate,NVL function in Function based Index..

1 Answers   Metric Stream, Polaris,


what are the different type of sql's statements ? : Sql dba

0 Answers  


Can unique keys be null?

0 Answers  


What is a temporal data type?

0 Answers  


what are the differences between require and include, include_once and require_once? : Sql dba

0 Answers  


Explain ddl statements in pl/sql?

0 Answers  


Categories