title: SQL query the largest and smallest amount
body: <p>I have a table <code>Sales</code> with the following fields: <code>code, amount, index, name</code>. </p>
  
  <p>I need to get the smallest and the largest <code>amount</code> for a given <code>name</code>, and the <code>code</code> for which the amount is the smallest and largest. </p>
  
  <p>Can somebody help me in constructing a query?</p>