HOW CAN I FIND MAX SAL ,ENAME FROM EMP TABLE.

Answers were Sorted based on User's Feedback



HOW CAN I FIND MAX SAL ,ENAME FROM EMP TABLE...

Answer / kanhu charan biswal

select ename, sal from emp where sal=(select max(sal) from
emp);

For see the max(sal) with ename departmentwise the query
will be:
select ename,sal from emp a
where sal in (select max(sal) from emp group by deptno);

For findout the nth highest salary with name, the query
will be:

select ename,sal from emp a
where &n=(select count(distinct sal) from emp b
where b.sal>=a.sal)
after execute the query it will ask you to pass a value
for 'n'.it stands for nth hiest salary

Is This Answer Correct ?    0 Yes 0 No

HOW CAN I FIND MAX SAL ,ENAME FROM EMP TABLE...

Answer / binod singh

SELECT max(Distinct sal),ename
FROM emp
/

SQL> select max(distinct salary) from employees;

MAX(DISTINCTSALARY)
-------------------
24000

Is This Answer Correct ?    3 Yes 5 No

HOW CAN I FIND MAX SAL ,ENAME FROM EMP TABLE...

Answer / ahmad nazmi

select ename , max(sal)
from emp
group by ename;

Is This Answer Correct ?    1 Yes 3 No

HOW CAN I FIND MAX SAL ,ENAME FROM EMP TABLE...

Answer / madhav

select ename from emp where sal=(select max(sal) from emp);
ENAME
---------
KING

--first execute the inner query like
select max(sal) from emp;
MAX(SAL)
---------
5000
--- after that salary value pass the outer query like
this
select ename from emp where sal=5000
ENAME
---------
KING

Email:thota.madhav@gmail.com

Is This Answer Correct ?    2 Yes 6 No

HOW CAN I FIND MAX SAL ,ENAME FROM EMP TABLE...

Answer / suresh kumar somayajula

SELECT ename,MAX(sal)
FROM EMP
GROUP BY ename;

Is This Answer Correct ?    9 Yes 15 No

HOW CAN I FIND MAX SAL ,ENAME FROM EMP TABLE...

Answer / ahmad nazmi

select ename , max(sal)
from emp
group by ename ;

Is This Answer Correct ?    4 Yes 11 No

Post New Answer

More SQL PLSQL Interview Questions

If i can use sys.check_constraints to display my constraints from my database using sql server 2005, how can i display then if i am using sql server 2000????

0 Answers  


What is PL/SQL Records?

0 Answers  


What does trigger mean in slang?

0 Answers  


types of exceptions and what is meant by pragma autonomous_transaction ?what is the use.

4 Answers   3i Infotech,


what are myisam tables? : Sql dba

0 Answers  






C. Normalize the following data up to the 3rd Normal form. Create the tables and insert the data given. Emp_ID Name Dept_Name Salary Course_Title Date_Completed 100 Adam Marketing 48,000 SPSS 6/19/2008 Surveys 10/7/2008 140 Bob Accounting 52,000 Tax Acc 12/8/2008 110 Cathy IT SQL Server 1/12/2008 C# 4/22/2008 190 Dan Finance 150 Emily Marketing 55,000 SPSS 6/16/2008 42,000 Analysis 8/12/2008 Queries 1. Find all Names who have completed the SPSS Course. 2. Find employee with max salary. 3. Find employee with 2nd max salary. 4. Find all employees in Dept “Marketing”. 5. Find all the employees who have taken more than 2 courses. 6. Find all the employees who have completed the courses before month of September.

0 Answers  


how to retrieve the top 3 salaries of the table using rownum

31 Answers   Oracle,


What is a delimiter in sas?

0 Answers  


what is the difference between inner and outer join? Explain with example. : Sql dba

0 Answers  


What are the types of keys?

0 Answers  


What does pragma mean?

0 Answers  


How can we link a sql database to an existing android app?

0 Answers  


Categories