title: How can I return the result of a select in a function in MySQL?
body: <p>I'm a student and I'm trying to get my function to return the result of my select, but I don't know what to put in the <code>RETURN</code>.</p>
  
  <p>I have tried to create functions with mathematical operations for example, and it works correctly for example:</p>
  
  <pre><code>DELIMITER $$
  CREATE FUNCTION `getScore`(`a` INT, `b` INT, `c` INT) RETURNS INT
  BEGIN
      RETURN a + b + c;
  END$$
  DELIMITER ;
  
  SELECT getScore(0.3, 0.4, 0.5);
  </code></pre>
  
  <p>But my problem is in this function, I don't know what to put in the <code>RETURN</code> or how to scrutinize the function:</p>
  
  <pre><code>DELIMITER $$
  
  CREATE FUNCTION `getCharacters`() RETURN 
  BEGIN
  
          SELECT * 
          FROM `characters` 
          WHERE `level` &gt; 50
  
  END$$
  
  DELIMITER ;
  
  SELECT getCharacters();
  
  </code></pre>
  
  <p>I have the next error:</p>
  
  <pre><code>A "RETURNS" keyword was expected. (near "RETURN" at position 34)
  </code></pre>
  
  <p>Thank you for any help and excuse me for my English.</p>