Very difficult SQL query
Posted
by db666
on Stack Overflow
See other posts from Stack Overflow
or by db666
Published on 2010-03-15T23:30:06Z
Indexed on
2010/03/15
23:49 UTC
Read the original article
Hit count: 204
For the following table definitions:
Name Null? Type Comments
------------------------------- -------- ---- ------------------------------------
ENUM NOT NULL NUMBER(4) ENUM should not exceed a length of 4.
ENAME CHAR(15)
ADDRESS CHAR(25) ADDRESS should not exceed 25 characters.
SALARY NUMBER(5)
OFFICE CHAR(4)
DNUM NOT NULL NUMBER(4) Department which this employee belongs to
department
Name Null? Type Comments
------------------------------- -------- ---- -------------------------------------
DNUM NOT NULL NUMBER(4)
DMGR NOT NULL NUMBER(4) Department manager
DNAME NOT NULL CHAR(15)
project
Name Null? Type Comments
------------------------------- -------- ---- -------------------------------------
PNUM NOT NULL NUMBER(4)
PMGR NOT NULL NUMBER(4) Project manager
PTITLE NOT NULL CHAR(15)
emp_proj
Name Null? Type
------------------------------- -------- ----
PNUM NOT NULL NUMBER(4)
ENUM NOT NULL NUMBER(4)
I have to write SQL query which will find the names of employees who do not share an office but work on the same project, and have different salaries... I've spent last three days trying to figure out something, but no idea as far. I will appreciate any advice.
© Stack Overflow or respective owner