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.

4 Replies to “How to find monthly salary of employee from annual in SQL?”

  1. not working amit, it shows

    ORA-00923: FROM keyword not found where expected

    this show the crt results
    “select e_name, sal/12 as monthly from emp;”

Comments are closed.