Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Update Question

Re: Update Question

From: Quentin Sherman Xue <qxue_at_sii.cl>
Date: Tue, 24 Nov 1998 20:30:31 GMT
Message-ID: <01be17f1$c54a7160$ec011592@qspc.sii.cl>


Here is your SQL command:

SQL> UPDATE DEPT D SET TOT_SAL=(SELECT SUM(SAL) FROM EMP E      WHERE D.DEPTNO=E.DEPTNO) Good luck. Quentin.



Quentin Xue Supervisor DBAs,Network & Security Consultant INTERNAL REVENUE SERVICE,Chile Working Phone: 56-2 6921746
Teatinos 120, Santiago, Chile       Working Fax: 56-2 6921701
e-mail: qxue@sii.cl                    WWW: http://www.sii.cl

-------------------------------------------------------------



shirushah_at_hotmail.com escribió en artículo <737ulf$skt$1_at_nnrp1.dejanews.com>...
> Table Name: Emp
>
> ename sal dnum
> John Chen 1,000 15
> Tom Hanks 2,000 12
> Amy Hall 2,500 15
> Don Fonz 3,000 12
>
> Table Name: Dept
>
> dnum dname tot_sal
> 15 Sales
> 12 R&D
> 14 Marketing
>
> I need to Update DEPT by setting tot_sal equal to the total salary of
> employees in each department. If a department has no employees, tot_sal
> should be set to zero. (I need to use only one sql statement)
>
> So at the end of the update dep should look like this.
> dnum dname tot_sal
> 15 Sales 3,500
> 12 R&D 5,000
> 14 Marketing 0
>
> Thanks
> SS
> &#137;
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
 

>
Received on Tue Nov 24 1998 - 14:30:31 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US