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 ?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what happens if null values are involved in expressions? : Sql dba

999


what is primary key? : Sql dba

952


What is scalar function?

998


Which sorts rows in sql?

967


Explain what is dbms?

985


Why is pl sql used?

937


What is nosql vs sql?

1121


What is self-join and what is the requirement of self-join?

1088


Is sql low level language?

960


What are tuples in sql?

1061


What is difference between hql and sql?

990


How delete all records from table in sql?

927


Write a sql query to find the names of employees that begin with ‘a’?

950


1) Synonyms 2) Co-related Subquery 3) Different Jobs in Plsql 4) Explain Plan 5) Wrap 6) Query Optimization Technique 7) Bulk Collect 8) Types of index 9) IF primary key is created then the index created ? 10) Foreign Key 11) Exception Handling 12) Difference Between Delete and Trunc 13) Procedure Overloading 14) Grant Revoke 15) Procedure Argument types. 16) Functions. 17) Joins

1536


what is a trigger in mysql? : Sql dba

1067