cartesian product [message #77345] |
Fri, 22 March 2002 12:04 |
Vidette P
Messages: 3 Registered: February 2002
|
Junior Member |
|
|
Hey do you have any idea what is wrong here. The output as per the text book should give only 5 rows selected but when I run this , this gives me 25 rows selected ie (5*5).
Which means it is most probably a cartesian product ( my WHERE statement is invalid so it is selecting every combination).
I tried every freaking WHERE clause and I keep getting 25 rows :-(
SET PAGESIZE = 37
SET LINESIZE = 60
SET FEEDBACK = OFF
COLUMN ename HEADING 'EMPLOYEE NAME' FORMAT a15
COLUMN dname HEADING 'DEPARTMENT NAME ' FORMAT a15
REM ** INSERT SELECT STATEMENT
SELECT e.ename, e.job, d.dname
FROM emp e, dept d
WHERE e.deptno = (SELECT d.deptno
FROM dept d
WHERE d.loc = UPPER('&location'))
/
SET FEEDBACK ON
REM CLEAR ALL FORMATTING COMMANDS
|
|
|
Re: cartesian product [message #77350 is a reply to message #77345] |
Mon, 01 April 2002 11:47 |
SD
Messages: 16 Registered: March 2000
|
Junior Member |
|
|
Try this. It might work...
SELECT e.ename, e.job, d.dname
FROM emp e, dept d
WHERE e.deptno = d.deptno and loc = upper ('&location');
|
|
|