Draw The Triangle 2 in SQL | HackerRank Solution

Hello coders, today we are going to solve Draw The Triangle 2 HackerRank Solution in SQL.

Draw The Triangle 2

Problem

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 2 in SQL

MySQL

set @row := 0;
select repeat('* ', @row := @row + 1) from information_schema.tables where @row < 20

Disclaimer: The above Problem (Draw The Triangle 2) is generated by Hacker Rank but the Solution is Provided by CodingBroz. This tutorial is only for Educational and Learning Purpose.

Leave a Comment

Your email address will not be published. Required fields are marked *