CodingSpace

[HackerRank/SQL] Alternative Queries - Draw The Triangle 1 본문

HackerRank

[HackerRank/SQL] Alternative Queries - Draw The Triangle 1

개발자_조이킴 2022. 7. 21. 09:57

Problem. Alternative Queries - Draw The Triangle 1


Link.

https://www.hackerrank.com/challenges/draw-the-triangle-1/problem?isFullScreen=true 

 

Draw The Triangle 1 | HackerRank

Draw the triangle pattern using asterisks.

www.hackerrank.com


Description.

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


Key Point. 

REPEAT,

 

information_schema.tables를 사용한 이유:

 


My Answer. 

SET @number := 21;
SELECT REPEAT('* ', @number := @number - 1) FROM information_schema.tables;

References. 

문제풀이: https://www.hackerrank.com/challenges/draw-the-triangle-1/forum

 

Discussion on Draw The Triangle 1 Challenge

Draw the triangle pattern using asterisks.

www.hackerrank.com

 

information_schema 테이블: https://rk1993.tistory.com/230

 

[MySQL]information_schema란 ? (정의 및 테이블 종류)

information_schema란 ? INFORMATION_SCHEMA란 MySQL 서버 내에 존재하는 DB의 메타 정보(테이블, 칼럼, 인덱스 등의 스키마 정보)를 모아둔 DB다. INFORMATION_SCHEMA 데이터베이스 내의 모든 테이블은 읽기 전용..

rk1993.tistory.com

 

Comments