Home » SQL & PL/SQL » SQL & PL/SQL » Can anybody solved this query
Can anybody solved this query [message #194940] Tue, 26 September 2006 04:53 Go to next message
vikasg2006
Messages: 80
Registered: March 2006
Location: Dubai
Member
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.

vikas
Re: Can anybody solved this query [message #194943 is a reply to message #194940] Tue, 26 September 2006 04:59 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Homework time is it?

The key to your problem (I'm going to make you do the legwork) is
rpad('*',floor(salary/1000),'*')
Re: Can anybody solved this query [message #339248 is a reply to message #194943] Thu, 07 August 2008 02:42 Go to previous messageGo to next message
anu_poorna
Messages: 3
Registered: August 2008
Junior Member
Hi,

Could u explain "rpad('*',floor(salary/1000),'*')" in detail ?

Regards,
Anu
Re: Can anybody solved this query [message #339251 is a reply to message #339248] Thu, 07 August 2008 02:44 Go to previous messageGo to next message
ThomasG
Messages: 3212
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
It is all explained in detail in the documentation.

Hey, your instructor also seems to have been lazy, because that is exactly the example that IS in the documentation. Very Happy

[Updated on: Thu, 07 August 2008 02:45]

Report message to a moderator

Re: Can anybody solved this query [message #339252 is a reply to message #339248] Thu, 07 August 2008 02:45 Go to previous messageGo to next message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
Could u explain "rpad('*',floor(salary/1000),'*')" in detail ?

Why? Did you try it? Did you try to understand it? Did you try to find rpad and floor functions in SQL Reference? Or are you just a lazy guy (like your use of IM speak shows it) that always wants others make all your job for you?

Regards
Michel
Re: Can anybody solved this query [message #339254 is a reply to message #339248] Thu, 07 August 2008 02:47 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
FLOOR(SAL/1000) tells you how many 1000 dollars the salary is
The RPAD command simply pads a string with that many '*' characters.
Thus you get a string which has an '*' for each 1000 dollars of salary that the employee gets.
Re: Can anybody solved this query [message #339279 is a reply to message #339252] Thu, 07 August 2008 03:45 Go to previous messageGo to next message
anu_poorna
Messages: 3
Registered: August 2008
Junior Member
Hi JRowbottom,

Thanks for your reply....
I had tried executing the query using floor and by not using floor.
But both gives the same o/p !!
Could i use the query floor ?

Regards,
Anu.
Re: Can anybody solved this query [message #339286 is a reply to message #339252] Thu, 07 August 2008 03:54 Go to previous messageGo to next message
anu_poorna
Messages: 3
Registered: August 2008
Junior Member
Hi Michel,

I didnt post a message to explain the query without trying !
I had tried it, But i cant get the relevant answer.so i had asked to explain the same.
Which shows you that i am lazy !

Regards,
Anu.
Re: Can anybody solved this query [message #339290 is a reply to message #339286] Thu, 07 August 2008 04:05 Go to previous message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
Which shows you that i am lazy !

This was a question, note the form and question mark.
But I note you didn't read the documentation otherwise you should not ask your last question.

Regards
Michel


Previous Topic: Need help building my first Oracle Trigger
Next Topic: Is It Possible To define a size of the Procedure Parametere?
Goto Forum:
  


Current Time: Fri Feb 07 00:07:24 CST 2025