Categories: SQL Complex Queries

How to find monthly salary of employee from annual in SQL?

In previous article I have provided information about the Second highest salary of employee in detail. In this article I would like to give you information about query to find monthly salary of employee if annual salary is given.

How to find Monthly Salary of Employee from Employee table if annual salary is given?

  • Answer:

   select Employee_name,Salary/12 as ‘Monthly Salary’ from employee;

What is Query to find Monthly Salary of Employee in SQL? – Explaination

As this query is really very simple to look but in this simple query we are explaining the concept of aliases. Following are the steps of executing this Query:

  • step1:

      Select * from Employee;

Output:

Employee_num Employee_name Department Salary
1 Amit OBIEE 680000
2 Rohan OBIEE 550000
3 Rohit OBIEE 430000
  • Step2 :

After this  We need to fetch only 2 columns from the Employee table.So following is the query to fetch required columns:

   Select Employee_name,Salary from Employee;

Output:

Employee_name Salary
Amit 680000
Rohan 550000
Rohit 430000
  • Step3:Fetch the actual records from query

select Employee_name,Salary/12 as ‘Monthly Salary’ from employee;

Output:

Employee_name Monthly Salary
Amit 56667
Rohan 45833
Rohit 35834

Here in above query we are taking alias for Salary column. Alias concept is very useful to give the business meanings (as per requirements) to the table column. We will directly divide the column which has number,float,double or any other numeric datatype. In above example we have considered the datatype as integer number so results of query has been rounded off. So In SQL you can directly divide salary by 12 so that you will Find Monthly Salary of Employee. There is no need to use calendar functions, Month functions in Oracle. I hope you like this article of Find Monthly Salary of Employee with example.

Using Following Link You Will be Able to see Complex SQLS:

>>>>>>>>>>>>>>>Click Here to See Complex SQLs<<<<<<<<<<<<<<<<<<<<<<

The above query is most common query if salary is given as annual and we require to calculate monthly salary These kind of queries are useful in SQL interview questions.

Amit S

Oracle Consultant with vast experience in Oracle BI and PL/SQL Development. Amiet is the admin head of this website who contributes by preparing tutorials and articles related to database technologies. He is responsible to manage the content and front-end of the website.

Share
Published by
Amit S

Recent Posts

What is Root Cause Analysis (RCA) With real examples

In my previous article I have given details about application support engineer day to day…

2 weeks ago

Application Support Engineer Day to day responsibilities

In my previous articles I have given the roles and responsibilities of L1,L2 and L3…

2 weeks ago

What is mean by SLA ( Service Level Agreement) with Examples?

In my previous articles i have given the hierarchy of production support in real company…

2 weeks ago

What is Production support Hierarchy in organization?

In this article i would like to provide information about production support organization structure or…

2 weeks ago

What are roles and responsibilities for L3 Support Engineer?

In my previous article I have given roles for L1 and L2 support engineer with…

2 weeks ago

What are roles and responsibilities of L2 Engineer?

I have started this new series of how to become application support engineer. This article…

2 weeks ago