title: P(R) represents a pattern drawn by Julia in R rows. The following pattern represents P(5)
body: <p>I recently started learning  mysql and got stuck in this question:</p>
  
  <p>P(R) represents a pattern drawn by Julia in R rows. The following pattern represents P(5):
  Write a query to print the pattern P(20).</p>
  
  <p><a href="https://i.stack.imgur.com/PrDGn.png" rel="nofollow noreferrer">the question</a></p>
  
  <p>I have written the answer like this:</p>
  
  <pre><code>DELIMITER $$
  BEGIN
  DECLARE CH VARCHAR(255);
  DECLARE CT INT DEFAULT 20;
  SET CH = ' *';
  WHILE CT&gt;0 DO
      SELECT REPEAT(CH,CT);
      SET CT=CT-1;
      END WHILE
    END $$
  DELIMITER ;
  </code></pre>
  
  <p>Somehow it's not working..what's missing?</p>