How can u find column name from a table which have max value
in a row.( not max value)
Answers were Sorted based on User's Feedback
Answer / mahalakshmi s
select case when col1>col2 then 'col1' else 'col2' end, greatest(col1,col2) end from table_name;
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / 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 |
Answer / ganesh
create table aa_test(
a number,
b number,
c number)
;
select greatest(a,b,c) from aa_test where a=99 ;
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / prashanth
user greatedt function.
Ex select greatest(sal,bonus) from emp where emp_id = 1000;
| Is This Answer Correct ? | 2 Yes | 6 No |
Can %notfound return null after a fetch?
Explain isolation levels. : Transact sql
what is a trigger in mysql? Define different types of trigger. : Sql dba
How do I run pl sql in sql developer?
What is difference between select statement and cursor
What is inner join in sql?
Which are sql * plus commands?
How many sql commands are there?
How much does sql certification cost?
Write a query to find five highest salaries from EMP table. (there is a column SALARY)
24 Answers Cap Gemini, iNautix,
What is the most common sql injection tool?
What is AUTH_ID and AUTH_USER in pl/sql ?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)