I have student marks in a student table. I need second
highest mark .Then what will the query for this?

Answer Posted / devi

Get data to internal table from database table using select query.
Sort the second internal table by ascending order.
Then use Delete adjacent duplicates comparing highest marks.
It will remove duplicate highest marks.
Then sort the internal table by descending order.
Read internal table into workarea index 2.
It will give the second highest mark.

Some times we have to process more steps using all data's. At that time we have to create two internal table with same structure . Move the data from firs table to second table and do the above steps.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an execution plan? How would you view the execution plan?

644


How many levels of sp nesting is possible?

684


How to insert and update data into a table with "insert" and "update" statements?

594


Explain different types of self contained sub query?

615


Explain the concept of recursive stored procedure.

577






List out different types of normalizations in sql server and explain each of them?

635


What are the types of user defined functions in sql server?

594


What is the stuff and how does it differ from the replace function?

631


In what version of sql server were synonyms released?

594


What are the parts of a function?

603


Explain nested stored procedure. Syntax and an example for create nested stored procedure?

610


Explain what is raid and what are different types of raid levels?

611


How will you decide the active and passive nodes?

716


How do you handle datasets larger than 50 gb?

146


What is create command?

609