Sometimes we may need to increase the current column value by Percentage. The very good example is Salary in an organization. We need to update the salary of each employee based on the Hike Percentage.
Increasing Salary By Percentage
In this example, lets assume the Hike percentage is equal for all employees, and I am counting 15 Percentage as Hike. Lets create the table and insert some records.
CREATE TABLE [Details].Employees ( Id INT IDENTITY(1,1), FullName VARCHAR(50), Salary FLOAT )
Inserting records into the Employees Table,
INSERT INTO [Details].Employees VALUES ( 'Sundaram', 1000.00 ), ( 'Saravana Kumar', 2000.00 ), ( 'Pushparaj', 3000.00 ), ( 'Karthik K', 4000.00 ), ( 'Akilan', 5000.00 )
Lets select all the records from the table Employee.
SELECT * FROM [Details].Employees
Now lets update the salary column by 15 percentage for all records.
UPDATE Details.Employees SET Salary = salary * 1.15
Select all the record from the table,
In this article, we discussed about how to increase the value by applying some percentage. I hope you all got some idea and found this article useful. Please share your feedback in the comment section.