Im between cherry

Hackerrank | MySQL | Draw The Triangle 1 본문

데이터분석/practice_query

Hackerrank | MySQL | Draw The Triangle 1

meal 2020. 8. 29. 16:19

Draw The Triangle 1

Problem

 

Higher Than 75 Marks | HackerRank

Query the names of students scoring higher than 75 Marks. Sort the output by the LAST three characters of each name.

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 @number:= 21;
SELECT REPEAT('* ', @number := @number -1)
FROM information_schema.tables
LIMIT 20;
-- 변수 설정할때는 @를 꼭 써준다.

SET @num=21;
SELECT REPEAT('* ',@num := @num-1)
FROM information_schema.tables
WHERE @num>1
Comments