title: SQL (not exists command)
body: <pre><code>create table class (cid integer primary key , cname text);
  
  create table student (sid integer primary key, sname text);
  
  create table attend ( cid integer , sid integer, grade integer);
  
  Select A.cid, S.sname, S.sid
  From Student S, Attend A
  Where S.sid=A.sid and not exists
  (Select *
  From Attend A2
  Where A2.cid=A.cid and A2.grade &gt; A.grade);
  </code></pre>
  
  <p>I don't understand why the result is: </p>
  
  <p>For each class id display the names of students that got the maximum grade in this class</p>
  
  <p>I thought it would instead return the student with minimum grade for each class.</p>
  
  <p>Could anyone help? Thanks!</p>