-- Examples from Section 3.11

-- Example 3.11.2

     select cname from customers c, orders x, products p
          where c.cid = x.cid and x.pid = p.pid and p.price = 0.50;

-- Example 3.11.4

    select avg(totdollars) from
       (select sum(dollars) at totdollars from orders
           group by aid) sumtab;

-- Example 3.11.6

     create table employees (eid char(4) not null, ename varchar(16),
          mgrid char(4));

-- Example 3.11.7

     select * from documents d         -- retrieve documents d  
          where not exists
          (select * from keywords k    -- ... where no keyword  
               where k.keyword in      -- ... in our list              
               ('Xyz1','Xyz2','Xyz3',
               'Xyz4','Xyz5','Xyz6')
               and not exists
               (select * from keywords m   -- ... fails to equal         
                    where m.keywordd = k.keyword  -- ... a keyword  
                    and m.docid = d.docid)); -- ... in the document d      

-- Example 3.11.8

     select aid, sum(dollars) from orders x group by aid
          order by 2 desc;


