15,607,737 members
See more:
increment the employee salary 15% if he has 2 years of experience?
table name=employee_info
columns are
emp_id;emp_name;salary;dateofjoin.

using SQL or SQL SERVER

Posted
Updated 19-Jan-23 3:50am
thatraja 19-Dec-13 5:15am
Don't repost questions hereafter. Update old questions with some more details. Or raise a comment vs answers.

So don't repost again unless you want your account get banned.

## Solution 1

It should be something like this..

SQL
```SELECT salary + (salary * 15/100) as NewSalary, emp_name
FrOM employee_info
Where DATEDIFF(MONTH, dateofjoin, GETDATE())/12 =2```

joginder-banger 18-Dec-13 10:37am
how can calculate date of Joining....
Maciej Los 18-Dec-13 11:03am
Have a look at WHERE clause ;)
Maciej Los 18-Dec-13 11:03am
+5!

## Solution 4

```CREATE TABLE #EMP(EmpID INT,EmpName VARCHAR(50),Salary MONEY,DOJ DATE);

INSERT INTO #EMP VALUES(1215,'HARISH',20000,'23-MAY-2015'),
(1234,'SaiKiran',30000,'23-DEC-2013'),
(1234,'SatishREDDY',15000,'05-AUG-2016'),
(1234,'Santosh',25000,'03-JUL-2015');

UPDATE #EMP
SET Salary=salary+Salary*.15
WHERE DATEDIFF(YEAR,DOJ,GETDATE())=2;

SELECT * FROM #EMP;
----------------------------------------------
EmpID	EmpName	      Salary	DOJ
-----------------------------------------------
1215	HARISH	     23000.00	2015-05-23
1234	SaiKiran     30000.00	2013-12-23
1234	SatishREDDY  15000.00	2016-08-05
1234	Santosh	     28750.00	2015-07-03```

CHill60 18-Nov-17 4:41am
Stick to answering new questions where the OP still needs help
Santosh kumar Pithani 18-Nov-17 5:44am
Sure :)

## Solution 2

SQL
```SELECT salary + (salary * 15/100) as Salary, emp_name
FrOM employee_info
Where DATEDIFF(MONTH, dateofjoin, GETDATE())/12 =2```

## Solution 10

i. Add a new column named bonus which is 15% of their salary.