I have a table(product),It contain fields(productname,cost).
I want to retrieve the product name ,which cost is second
maximum in the table?

Answer Posted / siri

select productname from product p where 2=(select count(*) from product q where p.cost<=q.cost)

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which are the db2 tools to protect integrity of the database?

688


What do you mean by rollback?

572


Is schema the same as database?

627


What is catalog database in db2?

640


What is runstats utility in db2?

569






How can you count the number of rows from a table tab?

633


How does a cursor work?

554


What are the contents of a dclmgen?

628


How to find the maximum value in a column in the db2 database?

605


what is a corelated subquerry?

654


Are views updateable?

641


How do you simulate the explain of an embedded sql statement in spufi/qmf?

634


How do I add a column in db2?

589


Mention the location where the output received from explain statement is stored.

628


What are the 2 sqlcodes that are returned?

634