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

The Essential Guide to Cryptocurrency Exchange Platform Development for Beginners and Beyond

Introduction Cryptocurrencies took the world by storm, setting up a new financial system and breaking…

5 months ago

Top 20 System Administrator Interview Questions and answers

In my previous article I have given Top 20 technical support interview questions with its…

8 months ago

Desktop Support Scenario Based Interview Questions

In my previous articles I have given 15 most asked desktop support interview questions with…

8 months ago

How Do Business Analysts Use SQL for Their Needs?

A business analyst is someone who is versed in processes of data analysis used for…

8 months ago

Top 15 Control-M Interview Questions with Answers

In my previous article I have already given top questions and answers for Desktop support…

8 months ago

Top 20 SQL Interview Questions for Production Support

In my previous article I have given unix production support interview questions and answers. In…

8 months ago