We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Draw The Triangle 2
Draw The Triangle 2
Sort by
recency
|
945 Discussions
|
Please Login in order to post a comment
For MySQL
declare @a as int=1 while @a <= 20 begin print replicate ('*',@a) set @a=@a+1 end
**2nd Way ** WITH Numbers AS ( SELECT 1 AS n UNION ALL SELECT n + 1 FROM Numbers WHERE n < 20 ) SELECT REPLICATE('* ', n) AS pattern FROM Numbers OPTION (MAXRECURSION 20);
The simplest way to solve this problem is this;
WITH RECURSIVE numbers(n) AS( SELECT 1
)
SELECT REPEAT('* ', n) FROM numbers;