Input: N = 20
Output:
Query In Oracle:
select rpad('*', level*2, ' *') from dual connect by level <= 20;
Here level refer to N = 20, you can change according to you.
Query In MySql:
with tree (number)
AS
(
select 1 AS nr
UNION ALL
select number+1 AS nr FROM tree WHERE number <= 19
)
select
REPLICATE('* ',number)
from tree
Order by number desc
Comments