what does following sql code do?

guys i have seen following code in internet

select round(abs(months_between(sysdate,add_months(hire_date,12*(round((months_between(sysdate,hire_date)/12)))))))
from employees

unfortunately there was not enough information if what does it do,i have run this command in my oracle 11.g database,and seen if of numbers,like 6,5,4,7,3,2

5
2
1
1
6
5
2
2
3

like this ,please i know functions,just can't determine it's usage here,what represent this numbers?please help me

Answers


Working from the inside out:-

round( (months_between(  sysdate,  hire_date)   /12)

Gets the number of complete years the employee has been employed

  add_months( hire_date,12 * (years calculated above )

Gets the date the employee completed n complete years since being employed

round(abs(months_between( sysdate, date employee completed n years )

Gets the number of months till the next full year of employment.

No idea why!


Need Your Help

opening a local folder browser from web browser

windows vb.net

I know this shouldn't be as hard as I have found it to be, but I could use some help on a problem. I have used, and am familiar with the FileUpload control, works great.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.