Department (Dept_ID, Dept_Name),
Employee (Emp_ID, Emp_name, Salary, Dept_ID) where Dept_ID is a foreign key references Department (Dept_ID)
And you are required to write a stored procedure with name Increase_Salary that takes a department ID and increase the salary of all employees of that department with 0.25 from their stored salary, and then prints the employee name, old salary, and new salary for those employee who their salaries exceeds salary threshold given as input for the stored procedure after their salaries have been updated.
i make code for it but not know it correct thinking or not(if i thought wrong tell me)
create table Department(Dept_ID int primary key , Dept_Name varchar(20)) create table Employee (Emp_ID int ,Emp_name varchar(20),Salary int , Dept_id int references Department(Dept_ID)) create procedure Increase_Salary @DepartmentID int as while(select count(Dept_id)from Employee) = @DepartmentID begin update Employee set NewSalary = Salary + 0.25 end group by Emp_name,Salary,NewSalary order by Emp_ID go
This post has been edited by mon mon: 28 March 2011 - 02:21 PM