Subquery 'NOT IN' : NOT IN « Query Select « Oracle PL/SQL Tutorial






SQL>
SQL>
SQL> SELECT COUNT(*) num_owned, a.owner
  2      FROM dba_objects a
  3      WHERE a.owner NOT IN (SELECT b.owner FROM dba_objects b
  4      WHERE b.owner LIKE 'SYS%')
  5      GROUP BY a.owner;

 NUM_OWNED OWNER
---------- ------------------------------
       473 MDSYS
         3 TSMSYS
      1143 FLOWS_020100
      2769 PUBLIC
         8 OUTLN
       575 JAVA2S
       339 CTXSYS
        34 HR
        12 FLOWS_FILES
        46 DBSNMP
       668 XDB

11 rows selected.








2.27.NOT IN
2.27.1.NOT IN reverses the rows selected by IN
2.27.2.NOT IN returns false if a value in the list is null
2.27.3.Deal with NULL with NOT IN and NVL
2.27.4.Subquery 'NOT IN'
2.27.5.NOT IN and subquery
2.27.6.Not equals and subquery