By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,265 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,265 IT Pros & Developers. It's quick & easy.

Update the salary of each manager to be double the average salary of the employees he/she manages

P: n/a


create table employee(empid int,empname varchar(20),managerid int not
null, sal int)

insert into employee values(1,'ranga',22,5000)
insert into employee values(2,'satish',22,8000)
insert into employee values(3,'sunil',11,4500)
insert into employee values(4,'sridhar',22,2000)
insert into employee values(5,'ramesh',33,12000)
insert into employee values(6,'srini',22,16000)
insert into employee values(7,'sashi',33,54000)
insert into employee values(8,'rajani',22,71000)
insert into employee values(9,'praveen',11,6060)
insert into employee values(10,'bhaskar',22,11120)
insert into employee values(11,'baba',33,9000)

create table employment (managerid int,managername varchar(20),sal int)

insert into employment values(11,'rob',2500)
insert into employment values(22,'babu',5000)
insert into employment values(33,'ram',6000)

now my problem is

Update the salary of each manager to be double the average
salary of the employees he/she manages

pls help

sati

Mar 23 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a

UPDATE employment
SET sal=(
SELECT AVG(employee.sal)*2
FROM employee
WHERE employment.managerid=employee.managerid)

Mar 23 '06 #2

P: n/a
thank u very much

Mar 23 '06 #3

P: n/a
"satish" <sa**********************@gmail.com> wrote in
news:11*********************@j33g2000cwa.googlegro ups.com:


now my problem is

Update the salary of each manager to be double the average
salary of the employees he/she manages

pls help

sati

What are you going to do when you actually have to answer
this question on the exam, and you can't cheat using
the newsgroup?

Mar 23 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.