Type of Triangle — Hackerrank -SQL

  • Isosceles: It’s a triangle with sides of equal length.
  • Scalene: It’s a triangle with sides of differing lengths.
  • Not A Triangle: The given values of A, B, and C don’t form a triangle.
Isosceles
Equilateral
Scalene
Not A Triangle
select 
(case
when not (a + b > c and b + c > a and c + a > b) then "Not A Triangle"
when a = b and b = c then "Equilateral"
when a = b or b = c or c = a then "Isosceles"
else "Scalene" end) from Triangles;

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store