Write a query to print the Inverted triangle in Oracle,MySql

Updated: Mar 18


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





Contact Us

Tel: (+91) 0120  4118730  

Time :   10 : 00  AM -  08 : 00 PM IST 

Registered address: G-69, Sector 63, 

 Noida - 201301, India

We Provide Services Across The different countries

USA    Australia   Canada   UK    UAE    Singapore   New Zealand    Malasia   India   Ireland   Germany

Terms and Conditions        Privacy Policy    Pricing Policy       Refund Policy         COPYRIGHT © 2021

Sofstack Technology Solutions Pvt. Ltd.

  • CodersArts | Linkedin
  • Instagram