please give me the answer for this:
query which generates the second highest integer in the table?

Answers were Sorted based on User's Feedback



please give me the answer for this: query which generates the second highest integer in the table?..

Answer / river

SELECT * FROM `student` where class='Six' ORDER BY mark desc
LIMIT 1,1

Is This Answer Correct ?    3 Yes 1 No

please give me the answer for this: query which generates the second highest integer in the table?..

Answer / salil

Without using LIMIT

SELECT max( t1.col )
FROM `table` t1
WHERE t1.col < (SELECT max( t2.col ) FROM `table` t2);

Is This Answer Correct ?    2 Yes 1 No

please give me the answer for this: query which generates the second highest integer in the table?..

Answer / sunil kumar

Sorry I have a mistake in above answer. The right answer is

select marks from tablename order by marks desc limit 1,1

Is This Answer Correct ?    1 Yes 0 No

please give me the answer for this: query which generates the second highest integer in the table?..

Answer / hamza tariq

select marks from tablename order by marks desc limit 1,1

Is This Answer Correct ?    1 Yes 0 No

please give me the answer for this: query which generates the second highest integer in the table?..

Answer / sunil kumar

select marks from tablename order by age desc limit 1,1

Is This Answer Correct ?    0 Yes 0 No

please give me the answer for this: query which generates the second highest integer in the table?..

Answer / vardhan rao

With Limit: nth highest salary

Select distinct(salary) from tablename order by salary desc
limit n-1,1

Is This Answer Correct ?    0 Yes 1 No

please give me the answer for this: query which generates the second highest integer in the table?..

Answer / richa

This is a general solution to nth level of salary

Select salary from (select salary from table order by salary
desc limit 3) tbl order by salary limit 1

Is This Answer Correct ?    0 Yes 2 No

please give me the answer for this: query which generates the second highest integer in the table?..

Answer / prasun

SELECT * FROM `student` where class='Six' ORDER BY mark desc
LIMIT 0,1

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More MySQL Interview Questions

How do stored procedures work?

0 Answers  


What is heap table?

0 Answers  


what is mysql optimization in brief?

0 Answers  


How can you count the total number of records of any table?

0 Answers  


What are the types of database engines available in mysql?

0 Answers  






How do I disable mysql?

0 Answers  


how do i list constraints in my database by using sql server2000?

1 Answers  


How do I find my mysql username and password?

0 Answers  


What is SERIAL data type in MySQL?

3 Answers   Aspire,


What is acid in mysql?

0 Answers  


How can I see mysql database?

0 Answers  


What are the objects can be created using CREATE statement?

0 Answers  


Categories