472,374 Members | 1,156 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,374 software developers and data experts.

second highest salary use the subquery

Expand|Select|Wrap|Line Numbers
  1. select max(sal) from emp
  2. where sal not in (select max(sal) from emp)
Oct 10 '13 #1
2 9289
12,516 Expert Mod 8TB
Please use code tags when posting code or formatted data.

Did you have a question?
Oct 10 '13 #2
Expand|Select|Wrap|Line Numbers
  1. SELECT max(sal) FROM emp WHERE salary < (SELECT max(sal) FROM emp);
  4. even u can check ur self 
  5. 1 select max(sal) from Emp;
  6.          MAX(SALARY)
  7. --------------------
  8.                 28.3
  10. select sal  from Employee order by sal desc
  11.   2  /
  13.               SALARY
  14. --------------------
  16.                 28.3
  17.                   12
  18.                  5.5
  20. SELECT max(sal) FROM emp WHERE salary < (SELECT max(sal) FROM emp);
  21.          MAX(SALARY)
  22. --------------------
  23.                   12

easy way to understand
Oct 11 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Mark | last post by:
good spam subject ;). anyway, i'm alittle stumped. i'm in need of putting together a query that gets the next highest salary ( select max ( sal ) - 1?, from an emp_sal type table. another...
by: Jaspreet | last post by:
I was working on some database application and had this small task of getting the second highes marks in a class. I was able to do that using subqueries. Just thinking what is a good way of...
by: tathagata | last post by:
I want second highest value in a table without using subquery. please send this answer .It will be very helpfull.
by: partha das | last post by:
sir i need a single sql query it may be sub query need to retrive the 5th highest salary from a employee table
by: apking | last post by:
please write the programe in c language for this Accept 5 Employee details to find highest salary employe name using for loop and arrays Thanks in advance
by: faizan qazi | last post by:
Hello Greetings Guide Me To Find Second Highest Number In Array
by: piyushdabomb | last post by:
Hi All, Currently, I have a table with 2 columns COMPONENTID and COMPLETIONDATE COMPONENTID COMPLETIONDATE CBT_HAZCOM 02/26/2007 15:17:00 CBT_HAZCOM 07/31/2007 21:23:00 QS 02/12/2007...
by: konaravikumar | last post by:
writing a query to get the second highest value in atable by using select statement
by: farzadaumixer | last post by:
hi umm i need help in writing a program in c(or c++) here are the details: i want it to recieve "x" numbers of student id's and the average of the student in their last term and i want it to...
by: ygsunilkumar | last post by:
select distinct (a.salary) from employees a where &N = (select count (distinct(b.salary)) from employees b where a.salary <= b.salary); Pls any one explain how the query works, logic behind it.
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.