title: How to get a single row in Mysql stored procedure with select
body: <p>I have been sreaching around and I could not find an answer to this question. It may be very simple or it could a bug, so any help to point out what I am doing wrong, it's appreciated in advance.</p>
  
  <p>I have a table where id is unique:</p>
  
  <pre><code>Table school
  ---------------------------
  id  name     class   fitness
  ---------------------------
  1    Joe      4      healthy
  2    Alice    7       good
  3    Bob      10     excellent
  </code></pre>
  
  <p>and the stored procedure is:</p>
  
  <pre><code>CREATE PROCEDURE checkid(IN ID INT)
  BEGIN
      SELECT * FROM school WHERE id = ID;
  END
  </code></pre>
  
  <p>executing the above procedure with following command:</p>
  
  <pre><code>CALL checkid(2)
  </code></pre>
  
  <p>returns the entire table. if I changed the SELECT statement to:</p>
  
  <pre><code>CREATE PROCEDURE checkid(IN ID INT)
  BEGIN
       SELECT * FROM school WHERE id = ID LIMIT 1;
  END
  </code></pre>
  
  <p>I get the first row of table as the return value like this which is wrong. </p>
  
  <hr>
  
  <pre><code>id  name     class   fitness
  ---------------------------
  1    Joe      4      healthy
  </code></pre>
  
  <p>how can I fix this?</p>