Forum     

Go Back   Digit Technology Discussion Forum > Portables, Peripherals and Electronics > QnA (read only)
Register FAQ Calendar Mark Forums Read

QnA (read only) Mods please help transfer the contents of this forum to proper sections. :)


 
 
LinkBack Thread Tools Search this Thread Display Modes
Old 26-09-2006, 12:38 PM   #1 (permalink)
Come get Some
 
DukeNukem's Avatar
 
Join Date: Aug 2005
Location: Home Sweet Home
Posts: 417
Question Simple Oracle Query


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.
DukeNukem is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 27-09-2006, 03:30 PM   #2 (permalink)
GUNNING DOWN TEAMS
 
wizrulz's Avatar
 
Join Date: Mar 2005
Location: MUMBAI
Posts: 1,724
Default Re: Simple Oracle Query

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.....
__________________
The moment U stop learning ......u stop improving

Last edited by wizrulz; 27-09-2006 at 03:30 PM. Reason: Automerged Doublepost
wizrulz is offline  
Old 27-09-2006, 03:40 PM   #3 (permalink)
Broken In
 
vikasg03's Avatar
 
Join Date: Oct 2005
Location: BaNgALOre
Posts: 181
Default Re: Simple Oracle Query

you can use floor also like this

rpad('*',floor(salary/1000),'*')
__________________
Vikas
vikasg03 is offline  
Old 27-09-2006, 03:53 PM   #4 (permalink)
GUNNING DOWN TEAMS
 
wizrulz's Avatar
 
Join Date: Mar 2005
Location: MUMBAI
Posts: 1,724
Default Re: Simple Oracle Query

yeah thats true...but to make it easy to understand if he really had problem......i used it other way around....
__________________
The moment U stop learning ......u stop improving
wizrulz is offline  
Old 22-03-2009, 12:16 PM   #5 (permalink)
Right Off the Assembly Line
 
Join Date: Mar 2009
Posts: 1
Exclamation 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!
binayak_oracle is offline  
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by clinton
- by Krow
- by clmlbx
- by Charan

Advertisement




All times are GMT +5.5. The time now is 11:35 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2