I hope any of you could enlighten my mind with a little problem i'm having here with the select...
First of all, I created a table called ZCON039.EMPLOYEE using this code:
CREATE TABLE ZCON039.EMPLOYEE
(EMPNO CHAR(6) NOT NULL,
FORENAME CHAR(20) NOT NULL,
INITIAL CHAR(1),
SURNAME VARCHAR(50) NOT NULL,
SEX CHAR(1) NOT NULL,
DOB DATE,
TELEPHONE CHAR(6),
DATE_HIRED DATE,
JOB CHAR(20),
SALARY DECIMAL(9,2),
BONUS DECIMAL(9,2),
COMMISSION DECIMAL(9,2),
DEPTNO CHAR(3),
LOCID CHAR(10),
PRIMARY KEY(EMPNO),
FOREIGN KEY (DEPTNO)
REFERENCES DEPARTMENT(DEPTNO) ON DELETE NO ACTION,
FOREIGN KEY (LOCID)
REFERENCES LOCATION(LOCID) ON DELETE NO ACTION)
IN SMDB039. SMTS039;
(EMPNO CHAR(6) NOT NULL,
FORENAME CHAR(20) NOT NULL,
INITIAL CHAR(1),
SURNAME VARCHAR(50) NOT NULL,
SEX CHAR(1) NOT NULL,
DOB DATE,
TELEPHONE CHAR(6),
DATE_HIRED DATE,
JOB CHAR(20),
SALARY DECIMAL(9,2),
BONUS DECIMAL(9,2),
COMMISSION DECIMAL(9,2),
DEPTNO CHAR(3),
LOCID CHAR(10),
PRIMARY KEY(EMPNO),
FOREIGN KEY (DEPTNO)
REFERENCES DEPARTMENT(DEPTNO) ON DELETE NO ACTION,
FOREIGN KEY (LOCID)
REFERENCES LOCATION(LOCID) ON DELETE NO ACTION)
IN SMDB039. SMTS039;
I also have a ZCON039.DEPARTMENT with this structure:
Column Name Data Type (Length) Null Key
-----------------------------------------------------------------------------------------------------------
DEPTNO CHAR(3) NO PRIMARY
SUPERIOR_DEPTNO CHAR(3) YES
MGRNO CHAR(6) YES
NAME VARCHAR(50) NO
-----------------------------------------------------------------------------------------------------------
DEPTNO CHAR(3) NO PRIMARY
SUPERIOR_DEPTNO CHAR(3) YES
MGRNO CHAR(6) YES
NAME VARCHAR(50) NO
Now, what I am supposed to do is: Produce a list of the total salaries of each department.
I tried a lot of queries here but maybe, for lack of knowledge of mine, couldn't get the desired (or any) output...
Could any of you help me please?
I appreciate it, thanks in advance,