title: Clarification Question with MAX and COUNT (sql)
body: <p>I am doing a couple homework problems and am a little confused how to use COUNT and MAX in my queries. I was wondering if someone can explain to me the 'where' part of these, or if I am just writing my coded completely wrong:</p>
  
  <p>The Catalog relation lists the prices charged for parts by Suppliers. Catalog.pid is a foreign key to Parts.pid. Catalog.sid is a foreign key to Suppliers.sid. Write the following queries in SQL. Execute them to make sure you get the correct answers. Copy the SQL queries and include the screenshot of the results as the answers. Do not list other attributes not specified in the return results.</p>
  
  <p>Catalog contains: pid, sid, cost</p>
  
  <p>Parts contains: pid, pname, color</p>
  
  <p>Supplier constains: sid, sname, address</p>
  
  <p>c. (2 points) Return the number of unique parts.</p>
  
  <pre><code>select count (distinct *) from Parts;
  </code></pre>
  
  <p>--This produces a compilation error on select, does anyone have advice for this?</p>
  
  <p>i. (1 point) Find the pids, pnames, and the maximum cost for that part among all the suppliers.</p>
  
  <pre><code>select p.pid, p.pname, c.cost from Parts p 
    inner join Catalog c on c.sid = p.pid
    inner join Suppliers s on c.pid = s.sid
    where max(c.cost);
  </code></pre>
  
  <p>I am not entirely sure if I am starting this correctly and I dont know what to consider when doing the 'where' part.. is it always needed?</p>