1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
mhouri.world >select d.deptno
2 , d.dname
3 FROM dept d
4 where not exists
5 ( SELECT null
6 FROM emp e
7 WHERE e.deptno = d.deptno
8 )
9 ;
DEPTNO DNAME
---------- --------------
40 OPERATIONS
mhouri.world >select d.deptno
2 , d.dname
3 from dept d
4 WHERE d.deptno not in
5 (select e.deptno
6 FROM emp e
7 )
8 ;
DEPTNO DNAME
---------- --------------
40 OPERATIONS
mhouri.world >insert into emp values (5,'Mohamed','sql', 7369,sysdate,100,0, null);
1 row created.
mhouri.world >select d.deptno
2 , d.dname
3 FROM dept d
4 where not exists
5 ( SELECT null
6 FROM emp e
7 WHERE e.deptno = d.deptno
8 )
9 ;
DEPTNO DNAME
---------- --------------
40 OPERATIONS
mhouri.world >select d.deptno
2 , d.dname
3 from dept d
4 WHERE d.deptno not in
5 (select e.deptno
6 FROM emp e
7 )
8 ;
no rows selected |