mercredi 20 novembre 2019

I want to use MySQL as a common programming language for print star patterns. How can I do this

I spend lots of time to solve this. I want to know what is wrong with this program.

DECLARE i INT;
SET i=5;
label1 : WHILE i>0 DO 
    SELECT REPEAT("*",i);
    CHAR(13);
    SET i=i-1;
END WHILE label1;

I wanted to print this.

*****
****
***
**
*

What is the syntax error of this? And I also want to know about MySQL syntaxes. What would you recommend me to learn about this type of question to solve with MySQL?

Aucun commentaire:

Enregistrer un commentaire