Skip to content
Advertisement

Generate a triangle of stars using mySQL recursive CTE

I’m trying to generate a triangle of stars in MYSQL that looks like this:

I’m using the following code to do in MYSQL

I get the error “Data too long for column ‘n’ at row 1”. Can anybody help me find out what’s wrong?

Advertisement

Answer

I guess MySQL is finicky about types. Try this:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement