Simple Oracle Query

Results 1 to 5 of 5

Thread: Simple Oracle Query

  1. #1
    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.
    Popular Gadget Deals

  2. #2
    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.....
    Last edited by wizrulz; 27-09-2006 at 03:30 PM. Reason: Automerged Doublepost
    The moment U stop learning ......u stop improving

  3. #3
    Broken In vikasg03's Avatar
    Join Date
    Oct 2005
    Location
    Dubai
    Posts
    184

    Default Re: Simple Oracle Query

    you can use floor also like this

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

  4. #4
    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

  5. #5
    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!

Similar Threads

  1. Oracle Simple Question
    By rajwansh2003 in forum QnA (read only)
    Replies: 1
    Last Post: 29-03-2009, 03:51 PM
  2. A simple query
    By thecoolone4u in forum Tutorials
    Replies: 1
    Last Post: 25-03-2007, 01:36 AM
  3. A simple query
    By thecoolone4u in forum Software Q&A
    Replies: 4
    Last Post: 25-03-2007, 01:35 AM
  4. A simple query
    By thecoolone4u in forum QnA (read only)
    Replies: 4
    Last Post: 25-03-2007, 01:35 AM
  5. Oracle 9i query>>help
    By ::cyborg:: in forum Software Q&A
    Replies: 6
    Last Post: 11-02-2007, 10:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Close