How can u find column name from a table which have max value
in a row.( not max value)
Answer Posted / gaurav
select decode( (select sal from emp where empno = 7521) , (select greatest( sal, comm ) from emp where empno = 7521 ), 'sal', 'comm' ) from dual
You can use multiple decode if more number of columns are there.
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Explain what is a database?
How do I run a script in sql developer?
Write a unique difference between a function and a stored procedure.
What are the different sql languages?
Write a sql query to find the names of employees that begin with ‘a’?
What are views in sql?
What is an index? What are the types of indexes? How many clustered indexes can be created on a table?
How do I start pl sql?
What is a data definition language?
What is varchar sql?
How to find 3rd highest salary of an employee from the employee table in sql?
what is data manipulation language? : Sql dba
What is record in pl sql?
How to fetch alternate records from a table?
What are reports usually used for?