# Simple Oracle Query



## DukeNukem (Sep 26, 2006)

Hye There 

Can any of you help me with this

Create  query that displays the employees last names and indicates the amounts of their annual salaries with asterisks. Each asterisk signifies a thousand dollars. Sort the data in descending order of salary. Label the column EMPLOYEES_AND_THEIR_SALARIES.


----------



## wizrulz (Sep 27, 2006)

select rpad(last_name,8 )||' '||RPAD(' ',salary/1000+1,'*') EMPLOYEES_AND_THEIR_SALARIES

From employee
order by salary DESC;


I THINK U GOT UR ANS 
__________
Did u genuinely had problem with this...as i feel u knew the ans and just wanted to check out members oracle knowledge.....


----------



## vikasg03 (Sep 27, 2006)

you can use floor also like this

rpad('*',floor(salary/1000),'*')


----------



## wizrulz (Sep 27, 2006)

yeah thats true...but to make it easy to understand if he really had problem......i used it other way around....


----------



## binayak_oracle (Mar 22, 2009)

*Can you please explain!*

Hi Friends,

Can you please explain why the RPAD 1st argument is simply space and why 1 is added to the salary after it is divided by 1000?

Thanks in advance!


----------

