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
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 |
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 |
what is inline view?
What is a database? Explain
table :- city name country code abc 11 bcd 22 cde 232 def 33 write a procedure , so that when we give a phone no. eg - 1123456789 - o/p sud be city name = abc if phone no. - 2322345897 , o/p sud be =cde note - bcd and cde city name sud be diff. as dey diff only with th last no. Pls ans. this questnion.
What is a pdo connection?
why use cursors?
How to create a table using constraints... IF i change the PARENT KEY value ,then CHILD KEY table will also to change in the another table... plz reply ur answers @ mak2786@gmail.com Arunkumar
How would you hide a table in sql. ie the table can be only visible to its maker?
How to delete same emp id in sql query for exmaple in emp table emp id, empname, emp address. for example emp id =5, repeated in two times in rows same id how to delete same empid please any one of the write query send in my id
What is Difference between StoredProcedure and function?
what are the limitations of identity column? : Transact sql
What is dense_rank?
What is pragma in sql?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)