Hello coders, today we are going to solve Draw The Triangle 1 HackerRank Solution in SQL.
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).
Solution – Draw The Triangle 1 in SQL
SELECT REPEAT('* ', @NUMBER := @NUMBER - 1) FROM information_schema.tables, (SELECT @NUMBER:=21) t LIMIT 20
Disclaimer: The above Problem (Draw The Triangle 1) is generated by Hacker Rank but the Solution is Provided by CodingBroz. This tutorial is only for Educational and Learning Purpose.