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?
select Employee_name,Salary/12 as ‘Monthly Salary’ from employee;
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:
Select * from Employee;
Output:
Employee_num | Employee_name | Department | Salary |
1 | Amit | OBIEE | 680000 |
2 | Rohan | OBIEE | 550000 |
3 | Rohit | OBIEE | 430000 |
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 |
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.
In my previous article I have given details about application support engineer day to day…
In my previous articles I have given the roles and responsibilities of L1,L2 and L3…
In my previous articles i have given the hierarchy of production support in real company…
In this article i would like to provide information about production support organization structure or…
In my previous article I have given roles for L1 and L2 support engineer with…
I have started this new series of how to become application support engineer. This article…