I was trying to solve one MySQL query at hackerrank, which demands to draw following pattern:
* * * * *
* * * *
* * *
SELECT REPEAT('* ', @NUMBER := @NUMBER - 1) FROM information_schema.tables, (SELECT @NUMBER:=6) t LIMIT 5
The way it works is that info schema dot tables has probably hundreds of rows in it for you.
You can verify that. It merely wanted some source that has more than 5 rows. It could have been anything.
It does a cross join to just initialize a variable (
@NUMBER) to the number 6. It brings back the repeat starting at 5 asteriks, 1 less per time, for a limit of 5 rows.