Find Monthly Salary of Employee If Annual Salary is Given in SQL?

To Find Monthly Salary of Employee If Annual Salary is Given in SQL, we are doing following step:-

  • Here first we have created one employee table.
  • In that table there are 5 column id, name, age, address and salary.
  • Here first we fetch the employee data.
  • we have to divide the annual salary by 12 and make an alias column as Monthly_Salary to view the monthly salary of each employee.

Query table :-    select * from employee;

ID NAME AGE ADDRESS SALARY
1 Vinay 25 Delhi 1500
2 Pankaj 23 Mumbai 2000
3 Ravi 25 Chennai 6500
4 Kamal 27 Bhopal 8500
5 Mukesh 22 Hyderabad 4500
6 Indresh 24 Indore 10000

To fetch monthly salary query :-  select id,name,age,address,(salary/12) as monthly_salary from employee;

ID NAME AGE ADDRESS MONTHLY_SALARY
1 Vinay 25 Delhi 125
2 Pankaj 23 Mumbai 166.666666666
3 Ravi 25 Chennai 541.666666666
4 Kamal 27 Bhopal 708.333333333
5 Mukesh 22 Hyderabad 375
6 Indresh 24 Indore 833.333333333