Create a query that displays the employees' last names and commision amounts.If an employee does not earn commmission, put "No Commission." Label the column COMM.

Questions by zecar   answers by zecar

Showing Answers 1 - 11 of 11 Answers

dev

  • Sep 18th, 2006
 

HI,

To retrieve the last names

for example if u have a table 'student' and field as 'name' like sri,ppp where sri is first name and ppp is last name.

select * from student where substr('name',instr('name',',',1,1)+1,length(name)) ='SRI';

then u can get last names.

if u have any doubt then feel free to ask me.

dev.

  Was this answer useful?  Yes

dev

  • Sep 18th, 2006
 

with this u can do:

select coalesce(comm,'no commission') "comm" from mm;

It will replaces null values with 'no commission'.

  Was this answer useful?  Yes

Rohan Deshpande

  • Oct 13th, 2006
 

query:- select last_ename,comm,nvl(to_char(comm),'no commission') comm from emp where comm is null;

  Was this answer useful?  Yes

Neeraj

  • Nov 7th, 2006
 

Hi,Suppose that you have a table EMP with the following structure.emp_id number(5)f_name varchar2(30)l_name varchar2(30)salary number(8,2)comm number(8,2) /* this column holds the commission values*/Now you can write your query as follows.SELECT l_name, nvl(comm,'No Commission') commission from EMP;The above query will give the desired output.

  Was this answer useful?  Yes

karthik

  • Jan 2nd, 2007
 

Check it out with this Query,select ename,decode(comm,NULL,'NO COMMISSION',comm,comm) from emp;

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.