Im between cherry

Hackerrank | MySQL | Draw The Triangle 2 본문

데이터분석/practice_query

Hackerrank | MySQL | Draw The Triangle 2

meal 2020. 8. 29. 16:22

Draw The Triangle 2

Problem

 

Draw The Triangle 2 | HackerRank

Draw the triangle pattern using asterisks.

www.hackerrank.com

 

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).

 

 

SET @num = 0;
SELECT REPEAT('* ', @num := @num+1)
FROM information_schema.tables
LIMIT 20
SET @NUM:= 0;
SELECT REPEAT('* ', @NUM := @NUM + 1)
FROM information_schema.tables
LIMIT 20;
Comments