GeekInterview.com
Series: Subject: Topic:
Question: 251 of 427

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.

Asked by: zecar | Member Since Sep-2006 | Asked on: Sep 12th, 2006

View all questions by zecar   View all answers by zecar

Showing Answers 1 - 11 of 11 Answers
dev

Answered On : Sep 18th, 2006

HI,To retrieve the last namesfor 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.

  
Login to rate this answer.
dev

Answered On : Sep 18th, 2006

with this u can do:select coalesce(comm,'no commission') "comm" from mm;It will replaces null values with 'no commission'.

  
Login to rate this answer.
Rohan Deshpande

Answered On : Oct 13th, 2006

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

  
Login to rate this answer.

Select nvl(to_char(commision),'no commision') "COMM" from jemployee2;

  
Login to rate this answer.
Neeraj

Answered On : 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.

  
Login to rate this answer.
karthik

Answered On : Jan 2nd, 2007

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

  
Login to rate this answer.
Rina_S

Answered On : Dec 24th, 2007

View all answers by Rina_S

select ename, nvl2(to_char(comm), to_char(comm), 'NO COMMISION') from emp

  
Login to rate this answer.
kssatya.69

Answered On : Dec 29th, 2007

View all answers by kssatya.69

Select  last_name "LAST NAME", nvl(comm,"NO COMMISSION") commission from employees;

  
Login to rate this answer.
netrasurve

Answered On : Jan 3rd, 2008

View all answers by netrasurve

select last_name "Emp LastName", nvl(Comm,"No Comission") "COMM" from employee

  
Login to rate this answer.

SELECT ename, nvl2(comm,to_char(comm),'no_commission') FROM employee;

  
Login to rate this answer.
pollysingh544

Answered On : Feb 22nd, 2010

View all answers by pollysingh544

Select last name,decode(commision,0,'No Commision',commision) comm from employee

  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.