GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL
Go To First  |  Previous Question  |  Next Question 
 SQL  |  Question 100 of 171    Print  
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.

  
Total Answers and Comments: 9 Last Update: January 03, 2008     Asked by: zecar 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
September 18, 2006 10:32:02   #1  
dev        

RE: Create a query that displays the employees' last n...

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.


 
Is this answer useful? Yes | No
September 18, 2006 10:39:39   #2  
dev        

RE: Create a query that displays the employees' last n...

with this u can do:

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

It will replaces null values with 'no commission'.


 
Is this answer useful? Yes | No
October 13, 2006 09:06:46   #3  
Rohan Deshpande        

RE: Create a query that displays the employees' last n...
query:- select last_ename comm nvl(to_char(comm) 'no commission') comm from emp where comm is null;
 
Is this answer useful? Yes | No
October 29, 2006 14:16:36   #4  
elektra Member Since: October 2006   Contribution: 10    

RE: Create a query that displays the employees' last n...
select nvl(to_char(commision) 'no commision') COMM from jemployee2;
 
Is this answer useful? Yes | No
November 07, 2006 14:40:25   #5  
Neeraj        

RE: Create a query that displays the employees' last n...
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.
 
Is this answer useful? Yes | No
January 02, 2007 07:29:14   #6  
karthik        

RE: Create a query that displays the employees' last n...
Check it out with this Query select ename decode(comm NULL 'NO COMMISSION' comm comm) from emp;
 
Is this answer useful? Yes | No
December 24, 2007 08:30:13   #7  
Rina_S Member Since: December 2007   Contribution: 2    

RE: 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.

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


 
Is this answer useful? Yes | No
December 29, 2007 10:20:27   #8  
kssatya.69 Member Since: December 2007   Contribution: 2    

RE: 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.
select last_name "LAST NAME" nvl(comm "NO COMMISSION") commission from employees;
 
Is this answer useful? Yes | No
January 03, 2008 22:48:29   #9  
netrasurve Member Since: January 2008   Contribution: 2    

RE: 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.

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


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape